Das ist mein Quiz ... Ich bin neu bei Python und ich bin perplex mit diesem. Am Ende gibt es ein {if result == 'no'} und wenn ich einen Fehler ausführe kommt man mit 'invalid syntax'. Ich hoffe, es ist nicht ein dummer Fehler, aber ich bin wirklich verwirrtif result == 'no' - Ungültige Syntax
Vielen Dank im Voraus - 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)
Wissen Sie, dass schließende Klammern sind notwendig? – abccd
Vorherige Zeile. Klammern. – user2357112
Vielen Dank an alle, wie kommentiert - abccd "Entschuldigung, dass ich wusste über Klammern, aber ich habe es nur nach vielen suchen verpasst !! –