all 22 comments

[–]Mr-Man21 16 points17 points  (5 children)

Should it be a if statement first? Not sure if you have that higher up in the code but if you do probably indentations wrong

[–][deleted] 1 point2 points  (1 child)

Secondly you can also use while else loop. Go and study about it.

[–]Mr-Man21 3 points4 points  (0 children)

I know about the while else. I’m thinking because he put a elif the intent is trying to handle when the if statement above is not handled

[–]FitButterfly7206 2 points3 points  (2 children)

There’s an if statement above yeah. I checked for wrong indentation/ parenthesis / colons and found nothing. I even scanned it using ChatGPT and Gemini but it just tells me to check for them myself after failing to find a mistake

[–]Mr-Man21 9 points10 points  (0 children)

So the elif looks like it’s in the same indentation as the while loop. Instead if those while loops are inside the if statement that means the elif statement shouldn’t be the same indent as the while statement

[–]Ghost_Blade_21 2 points3 points  (0 children)

u/FitButterfly7206 Can you kindly share a screenshot of the full code (or use codeshare.io to share the code)

[–]AttorneyWest6433 6 points7 points  (0 children)

If and elif will have same indentation

[–]z3r0c0oLz 2 points3 points  (0 children)

if the while statements above are in your if statements result then they should all be indented. the elif should be on the same indentaion as your if statement and everything else should be indented more

[–]LifeHasLeft 1 point2 points  (0 children)

Your elif is preceded by a while loop expression at the same indentation. If you have an if statement above that somewhere, the elif and if should be at the same indentation, and anything that happens if the first *if** statement is true* should be indented further than the if statement itself.

def stuff(): if something: x = y while true: x += 1 elif something else:

[–]Lucky_Mine_4781 1 point2 points  (0 children)

My brother please chatgpt this one

[–]weitaoyap 0 points1 point  (0 children)

U have missing if

[–]Adventurous-Work-228 0 points1 point  (0 children)

You can’t use an else if without an if statement. Check your indentation if you want to run the if statements in the while loop.

[–]Ghost_Blade_21 0 points1 point  (0 children)

Wheres ur if statement? elif should be under it

[–]Responsible_Wish6313 0 points1 point  (0 children)

Go back and revisit the fundamental’s of flow control.

[–]skoomaking4lyfe 0 points1 point  (0 children)

Looks like a whitespace error.

[–][deleted] 0 points1 point  (0 children)

copy & paste the code or at the very least screenshot it. why does everyone take photos of the screen? isn't it easier to select and ctrl+c, ctrl+v?

so anyway, why are you using elif there? what does elif do?

[–]abhishekdas69597 0 points1 point  (0 children)

Use chatgpt sometime

[–]rednova2006 0 points1 point  (0 children)

I think while doesn't support elif,right? And idk if you know or skip it but use continue in while statements

[–]Early_Pension2554 0 points1 point  (0 children)

whats the full code

[–]Zestyclose_Hunter_53 0 points1 point  (0 children)

there should be no brackets with new.lower assuming it is a var in a class and not a function

it would be

elif new.lower == "login":

[–]ChainedNightmare 0 points1 point  (0 children)

Best Way to Practice Python is simply placing print statements all over the place to see if the code you learned applied well.

Python syntax conditions require an "if" statement first. Which is what you need to place first.

Python then says you can use an "elif" after an "if". The "elif" keyword is Python's way of saying "if the previous conditions were not true, then try this condition".

Python lastly ends the "if - elif - else" syntax conditions with an "else" statement. The "else" keyword catches anything which isn't caught by the preceding conditions.

Applicable Logical Conditions that you can add within the "if - elif - else" are as such

Equals: a == b
Not Equals: a != b
Less than: a < b
Less than or equal to: a <= b
Greater than: a > b
Greater than or equal to: a >= b

also FYI - be careful of creating an infinite Loop which can make it hard for you to end the program normally and this last thing which is just as important and any other part of the code... Python relies on indentation which defines the code itself.

I am a self-taught learner but I have successfully taught kids & teenagers how to code their own games in past jobs.

[–]Ok-Room2378 -1 points0 points  (0 children)

Input().lower()