Jump to content

Recommended Posts


 

 
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 by dil_bert
Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.