0

The first part is the code I used that for some reason isn't working?

def main(): 
    # inputs and displays a person’s address, nicely formatted 
    print ("Program that displays a person’s address, nicely formatted\n")
    firstName = input("Enter your first name: ")   
    lastName = input("Now enter your last name: ") 
    streetAddress = input("Next enter your street address, (e.g., 943 West  Main     St.): ") 
    city = input("Next enter the name of your city or town: ")     
    state = input("Next enter your state: ") 
     ZIP = input("Enter your zip-code: ")     
    phoneNumber = input("Finally, enter your phone number (e.g.,       719-598-0200):") 
     print("\nHere is the address of:",firstName,lastName)
    print("\tStreet:\t",streetAddress)    
    print("\tCity:\t",city)     
    print("\tState:\t",state)    
    print("\tZIP:\t",ZIP)
    print("\tPhone Number:\t",phonenumber)
main()

This is the error message:

Traceback (most recent call last):
File "D:/Users/harve_000/Desktop/Try1.py", line 4, in <module>
firstName = input("Enter your first name: ")
File "<string>", line 1, in <module>
NameError: name 'ryan' is not defined.
Anand S Kumar
  • 88,551
  • 18
  • 188
  • 176
  • you probably meant to use `raw_input` instead of [`input`](https://docs.python.org/2/library/functions.html#input) ;) – Nir Alfasi Aug 28 '15 at 05:29
  • @user3265173 - Your code will also work. Just make sure while entering data/value you are putting quotes around it. Instead of typing just ryan, give input as "ryan". – Dinesh Pundkar Aug 28 '15 at 05:49

0 Answers0