I keep getting a syntax error on the while loop, and I’m not understanding why.
def main():
n=1
i=1
flag=True
num1=eval(input("Enter number")
while i<9:
n=n+1
num2=eval(input("Enter number", n))
r=r+1
if num2<num1:
flag=False
num1=num2
if flag==True:
print("yes")
else:
print("no")
main()
You left a parameter open at num1=eval(input(“Enter number”))
I also changed r = r + 1 to r+=1, they do the same thing but it reads a little bit nicer.
you can also insure that the number is an integer by changing it to:
num1=int(input(“Enter number: “))
Also, I think the n+=1 needs to be i+=1 to end the infinite loop.