DEV Community 👩‍💻👨‍💻

Lakshya Tyagi
Lakshya Tyagi

Posted on

What will be the output of given code?

Write output of code in comment

i=0
while i<3:
    print(i)
    i++
    print(i+1)
Enter fullscreen mode Exit fullscreen mode

Top comments (8)

Collapse
 
redhap profile image
HAP • Edited on
0
2
1
3
2
4
Enter fullscreen mode Exit fullscreen mode
Collapse
 
thomasmatecki profile image
Thomas Matecki • Edited on

SyntaxError?

Collapse
 
jennrmillerdev profile image
Jen Miller

lol I'm not a python developer, but if that's the answer to the question...

Collapse
 
thomasmatecki profile image
Thomas Matecki

i++ isn't valid syntax in python.

Thread Thread
 
lakshyatyagi24 profile image
Lakshya Tyagi

yes you are correct i++ is not a valid syntax in python

Collapse
 
promikecoder2020 profile image
ProMikeCoder2020

It will give a error because there are no increment operators in python

Collapse
 
dibyadarshan8 profile image
Dibyadarshan Rath

SyntaxError

Collapse
 
sambhavjindalgithub profile image
Sambhav-Jindal-github

I think it's not correct

An Animated Guide to Node.js Event Loop

>> Check out this classic DEV post <<