dil_bert Posted January 13, 2019 Share Posted January 13, 2019 (edited) HELLO Dear all - i have the code below running but it gets errors File "/home/martin/.PyCharmCE2018.2/config/scratches/p1_.py", line 3 phoneBook = {} ^ IndentationError: expected an indented block Process finished with exit code 1 see the code below def main(): phoneBook = {} name = input("Please enter a name(or press enter to end input): ") while name != '': number = input("Please enter number: ") phoneBook[name] = number name = input("Please enter a name(or press enter to end input): ") if name == '': print("Thank You!") print("Your phonebook contains the following entries:\n",phoneBook) main() Edited January 13, 2019 by dil_bert Link to comment https://forums.phpfreaks.com/topic/308168-indentationerror-expected-an-indented-block/ Share on other sites More sharing options...
requinix Posted January 14, 2019 Share Posted January 14, 2019 Look at it def main(): phoneBook = {} and tell me what the #1 rule of Python code is. Link to comment https://forums.phpfreaks.com/topic/308168-indentationerror-expected-an-indented-block/#findComment-1563559 Share on other sites More sharing options...
dalecosp Posted January 15, 2019 Share Posted January 15, 2019 20 hours ago, requinix said: Look at it def main(): phoneBook = {} and tell me what the #1 rule of Python code is. an indented block ? Link to comment https://forums.phpfreaks.com/topic/308168-indentationerror-expected-an-indented-block/#findComment-1563595 Share on other sites More sharing options...
Recommended Posts