Reputation: 11
print('hello world!')
print('what is your name?') #ask for their name
MyName = input()
print('It is good to meet you' + MyName)
print('The length of your name is: ')
print((len(MyName))
print('What is your age?') #ask for their age
MyAge = input()
print('You will be ' + str(int(MyAge) + 1) + ' in a year.')
I keep getting invalid syntax on the what is your age line. I do not know what is wrong with it. I checked to make sure I have the correct amount of parenthesis and apostrophes. Not sure what to do. I am learning of the Automate the boring stuff with python YT courses. Any help greatly appreciated
Upvotes: 0
Views: 124
Reputation: 1
you added an extra parentheses at line 6 and didnt closed it.
print('hello world!')
print('what is your name?') #ask for their name
MyName = input()
print('It is good to meet you' + MyName)
print('The length of your name is: ')
print(len(MyName))
print('What is your age?') #ask for their age
MyAge = input()
print('You will be ' + str(int(MyAge) + 1) + ' in a year.')
Upvotes: 0
Reputation: 27547
You get invalid syntax because you had an open bracket, and switched lines without closing it.
print((len(MyName))
should be print(len(MyName))
Upvotes: 1