I recently started my python course. I want to allow the user input again (back to the first line of question) after getting invalid inputs, therefore I added in the while loop. However, now, when the input is "yes", python prints out "I do not understand". Can I know what is wrong with the code and how should I fix it?
Here is the code
print('Hi, I am your bot, James!')
while True:
user_reply=input("Are you ready for today's activity? ")
if user_reply.lower == 'yes':
for_calculation()
elif user_reply.lower() == 'no':
while True:
double_confirm=input('Are you sure? ')
if double_confirm.lower() == 'yes':
print('See you next time.')
exit()
elif double_confirm.lower() == 'no':
for_calculation()
else:
print('I do not understand.')
else:
print('I do not understand.')
And here's the result
Hi, I am your bot, James!
Are you ready for today's activity? yes
I do not understand.
Are you ready for today's activity?
if user_reply.lower == 'yes':withif user_reply.lower() == 'yes':