DEV Community

Lakshya Tyagi
Lakshya Tyagi

Posted on

1 2

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
0
2
1
3
2
4
Enter fullscreen mode Exit fullscreen mode
Collapse
 
thomasmatecki profile image
Thomas Matecki • Edited

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

Postmark Image

Speedy emails, satisfied customers

Are delayed transactional emails costing you user satisfaction? Postmark delivers your emails almost instantly, keeping your customers happy and connected.

Sign up

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay