I want to print the "bye" after breaking the True while, but I'm having trouble. Here is my code
while (True) :
number = (input("pleas enter a number : \n"))
if number == ("don") :
break and print("bye")
else:
number = int(number)
if number%2 == 0 :
print("even")
else :
print("Odd")
and this is the ful error:
line 4
print("bye") and break
^^^^^
SyntaxError: invalid syntax
All this code is to distinguish even and odd numbers received from the user. My goal was to write an true while to receive an infinite number of numbers from the user, and when the user uses the "don" command, this loop end and show the "bye" message to the user. But this code encountered an error and the program did not run
break and print("bye"). Just print('bye') and move the break statement to the next line