Error meaning and how to fix it?
Go to solution
Solved by Avocado Diaboli,
You need to look at the indentation. That elif-statement isn't on the same depth as the if-statement, so the interpreter assumes you're trying to use an elif-statement without a preceding if-statement. Never mind that everything between the if- and elif-statements is probably not going to be executing the way you intend.
You have two options. Either indent everything between if and elif to the same depth, like this:
while True: ag=input("\nENTER E TO REROLL\n") if ag=="E" or ag=="e": for i in range(_q): r1=random.choice(list2) list1.append(r1) list2.remove(r1) print("LOADING...") time.sleep(2) os.system("clear") for i in list1: print(i, end="") elif ag=="!exit": break
Or you reorder the if and elif statements or turn the elif into a guard clause by basically asking if ag=="!exit" first and breaking immediately, instead of evaluating if it's "E" or "e" in the first place. Basically this:
while True: ag=input("\nENTER E TO REROLL\n") if ag=="!exit": break if ag=="E" or ag=="e": #do the rest
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now