Issue running a working code from Jupytr to Console


When I run this code from the Jupytr it works fine
n = 5
while n > 0 :
n = n - 1

on my command prompt on the console it gives me this error


Hi @RakeshNambiar,

I think you are using Python 2 not Python 3. Are you trying it on CloudxLab?


I am.
I think you are right.
How do I get to a python3 console


Please follow below steps for Python 3

source activate py36


I get the same error


Rakesh ,
Looks like, the Python recognize the print(‘Blastoff!’) is inside the While loop, In that case the in intentation error makes it invalid syntax. So once you are done with your while loop have a blank line to end the while loop, and then have your print(‘Blastoff!’) .

n = 5
x = 10
while n > 0 :
	n = n - 1