PersonsName = input('Enter your name: ')
print('Hello', PersonsName)
AnswerToHowAreYouToday = input('How are you feeling today? Are you doing Good or Bad?')
print('Ok', PersonsName,'So today you are basically feeling', AnswerToHowAreYouToday, '.')
a = "Good"
b = "Bad"
if AnswerToHowAreYouToday: a
print('Good')
else:
print('Bad')
最佳答案
您的 if else 语句缩进错误。通常四个空格用于缩进并且优于制表符。行继续中可以忽略缩进。但始终缩进是个好主意。
PersonsName = input('Enter your name: ')
print('Hello', PersonsName)
AnswerToHowAreYouToday = input('How are you feeling today? Are you doing Good or Bad?')
print('Ok', PersonsName,'So today you are basically feeling', AnswerToHowAreYouToday, '.')
a = "Good"
b = "Bad"
if AnswerToHowAreYouToday == a:
print('Good')
else:
print('Bad')
关于python - 我的 Python if else 语句有什么问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59465472/