elif loop help | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

elif loop help

I'm trying to pull class info into a elif loop. think the basic calculator code from early on in the python course. but when I give it the user input it only responds with the first elif regardless what loop I try to acsess. I'd share the code but I'm building it on my tablet witch is offline

4th Sep 2017, 2:12 AM
Aaron Baker
Aaron Baker - avatar
6 Answers
0
You may not have made this mistake in the real thing but in the example you didnt put user_input again after the or.
4th Sep 2017, 3:26 AM
Enzo
Enzo - avatar
+ 2
quote/You may not have made this mistake in the real thing but in the example you didnt put user_input again after the or./quote THANK YOU ENZO!!!!!! that's totally what was screwing my code up. I didn't realize Id have to retype user_input== after the or. it's working like a champ now. I wish I could up vote your response multiple times
4th Sep 2017, 4:02 AM
Aaron Baker
Aaron Baker - avatar
0
this isn't the full code but it should help. I'd rather not have to retype 75 lines of code https://code.sololearn.com/c1xCIxrsGrEu/?ref=app I have a super class wit 3 subclasses depending on what the user types it will bring you to one of the elifs but no matter the input it only returns the first one. only one that works right is the type exit to quit funtion with the if user_input == exit break also I'm aware the code I linked would t actually run as its not a full loop
4th Sep 2017, 2:21 AM
Aaron Baker
Aaron Baker - avatar
0
I don't get any errors from it tho?
4th Sep 2017, 2:57 AM
Aaron Baker
Aaron Baker - avatar
0
I do one space as a time what should I be doing then? I don't exactly have a tab button
4th Sep 2017, 3:06 AM
Aaron Baker
Aaron Baker - avatar
0
in building in qpython3 on the tablet. code playground don't work to well without internet
4th Sep 2017, 3:08 AM
Aaron Baker
Aaron Baker - avatar