Reputation: 37
Using python 3.6.6 on Windows 10.
I'm trying to get this menu working, except I keep getting a syntax error at the i
in input
. I've tried have the menu options be a print statement instead while having option = input()
afterwards, but that also leads to syntax errors.
Heres the menu code -
repeat = True
while repeat = True:
option = input("""Please choose an option:
1) Bubble Sort
2) Merge Sort
3) Binary Search
4) Linear Search
5) Quit
""")
try:
option = float(option)
if option > 5:
repeat = False
else:
if option == 1:
bubbleSort()
elif option == 2:
mergeSort()
elif option == 3:
binarySearch()
elif option == 4:
linearSearch()
elif option == 5:
quit("Now quitting...")
except ValueError:
print('Sorry, that is not an available option. Please try again. ')
Upvotes: 0
Views: 235
Reputation:
On line 2, you're missing a =
. You code should be:
while repeat == True:
not
while repeat = True:
Additionally, you don't need the == True
part. Only
while repeat:
will do.
Upvotes: 1
Reputation: 16593
Missing the second =
:
while repeat == True:
But you can simplify this to:
while repeat:
Upvotes: 2