Does anyone know why certain code does not work in Code Playground but works OK on the IDLE suggested by SOLOLEARN? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Does anyone know why certain code does not work in Code Playground but works OK on the IDLE suggested by SOLOLEARN?

I have some Python 3 code which runs OK on the IDLE suggested by Sololearn, but does not work on Code Playground. It is called " My Basic Calculator" - Mark Spencer

27th Jan 2018, 8:41 PM
Mark Spencer
Mark Spencer - avatar
2 Answers
+ 4
You should indent back the lines 50-53 by two tabs. Those *have* to be executed no matter what. Now they are conditioned with other variables being of certain values which may not always be True. This is why in some cases the 'num2' variable does not get initialized.
27th Jan 2018, 9:13 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 2
Thanks very much that makes sense - num2 error no longer occurs
27th Jan 2018, 9:55 PM
Mark Spencer
Mark Spencer - avatar