Here's my code:
#Greeting
print('\n---Automatic Troubleshooter---\n')
#UserInput
userInput = input('Are you having issues with your Wi-Fi?: ')
#QuestionAnswer
if (userInput == 'Yes' or userInput == 'yes'):
print('\nReboot the computer and try to connect.')
userInput = input('Did that fix the problem?: ')
if (userInput == 'No' or userInput == 'no'):
print('\nReboot the router and try to connect.')
userInput = input('Did that fix the problem?: ')
if (userInput == 'No' or userInput == 'no'):
print('\nMake sure the cables between the router & modem are plugged in firmly.')
userInput = input('Did that fix the problem?: ')
if (userInput == 'No' or userInput == 'no'):
print('\nMove the router to a new location and try to connect.')
userInput == input('Did that fix the problem?: ')
if (userInput == 'No' or userInput == 'no'):
print('\nGet a new router.')
else:
print('\nExiting program...\n')
else:
print('\nExiting program...\n')
Whenever I get to the last if statement, regardless of what I input, it always prints 'Get a new router'. At first, I didn't have the first else and the last else; I just had the 'Exiting program...' outside, and in my mind, it should've worked. If the problem is fixed, it shouldn't continue with the rest and print 'Exiting program...' Also, when I change the condition it works. So when I change the last if statement's condition from 'No' and 'no' to something else, it works.
Aucun commentaire:
Enregistrer un commentaire