I don't know why this particular python code is not running | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

I don't know why this particular python code is not running

https://code.sololearn.com/c6N9jIB72s0R/?ref=app

28th Jul 2017, 9:00 PM
Joseph Adepoju
Joseph Adepoju - avatar
5 Answers
+ 1
Slak and Amarie are correct and to fix the while statement I added a try and except I've edited it. Once you've fixed yours I'll delete this: https://code.sololearn.com/c1WgK4DjdgjV/?ref=app
28th Jul 2017, 9:43 PM
God Usopp
God Usopp - avatar
+ 4
@Slak, you can use ";" in python to do things like that : i=0 j=1 while i<5: j*=2;i+=1
28th Jul 2017, 10:51 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 3
Well there is a lot of problems firstly some of your code is not properly indented. Indentation is very important in python Secondly I saw a ';' in there somewhere Python dont use ';' after the lines of code Thirdly some of your elif statements don't have a ':' after them But just look at what the compiler give as a error, Python is very good at giving meaningful error messages
28th Jul 2017, 9:20 PM
Slak
Slak - avatar
+ 3
I would suggest you to start with fixing this large number of indentation errors. Futher 'while True' is really bad style and you should remove semicolons after statements because this isn't done in python...
28th Jul 2017, 9:24 PM
Amarie
+ 3
Nice I didn't know that :) Thanks for teaching me something new
29th Jul 2017, 5:19 AM
Slak
Slak - avatar