Can we use parentheses with an if statement or a while loop in python? I am a beginner so excuse my question. Thank you. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

Can we use parentheses with an if statement or a while loop in python? I am a beginner so excuse my question. Thank you.

Parentheses in Python

11th Feb 2018, 12:38 PM
Andrew Siachos
Andrew Siachos - avatar
4 Answers
+ 10
# Try running this code snippet in the codePlayground or any other IDE you prefer ;) x = 1 while (x <= 5): if (2==2): print("yes!") else: print("no!") x += 1
11th Feb 2018, 12:42 PM
Dev
Dev - avatar
+ 2
Yes
11th Feb 2018, 1:55 PM
Merer
Merer - avatar
+ 1
Thank you very much.
11th Feb 2018, 2:45 PM
Andrew Siachos
Andrew Siachos - avatar
0
I don't think so there is indentation decide the scope of loop or if else
12th Feb 2018, 6:15 PM
ankit bihani
ankit bihani - avatar