这是我的测验...我对python有点新意,我对这个很困惑。最后,有一个{if result ==' no'}当我运行错误时,您会遇到无效的语法'。我希望这不是一个愚蠢的错误,但我真的很困惑
提前致谢 - Nic
print('What is your name?')
user_name = input('Name: ')
print()
print('Question 1')
age = input('How old are you ' + user_name + '? ')
print()
print('Question 2')
colour = input("What's your favourite colour " + user_name + '?')
print()
print('Question 3')
town = input('What town do you live in ' + user_name + '?')
print()
print('Question 4')
result = input('Do you want to see your results ' + user_name + '? (yes / no)')
print()
if result == 'yes':
print('Age: ' + age + '\nFavourite Colour: ' + colour + '\nTown of residency: ' + town
if result == 'no':
print('What ever')
print('Age: ' + age + '\nFavourite Colour: ' + colour + '\nTown of residency: ' + town)
答案 0 :(得分:2)
print('Age: ' + age + '\nFavourite Colour: ' + colour + '\nTown of residency: ' + town
您忘记了结束)