I am new to python:
my aim is to print a done statement after while loop
but it gives me syntax error
>>> i=0
>>> while i < 10:
... print i
... i=i+1
...
... print "done"
File "<stdin>", line 6
print "done"
^
SyntaxError: invalid syntax
<?php
$i=0;
while($i<10)
{
echo "$i
";
}
echo "done";
?>
I am trying to replicate the same php program in python
i tried
>>> i=0
>>> while i < 10:
... print i
... i=i+1
... print "done"
File "<stdin>", line 4
print "done"
^
SyntaxError: invalid syntax
still it fails
cant we use a print after end or do we have to wait for the while to finish and do the print
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…