Can we use curly braces in loop | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Can we use curly braces in loop

8th Jun 2017, 7:40 PM
mayur
mayur - avatar
3 Answers
+ 5
You need to get used to Python way even though it might be ugly to people with C++, C#, PHP, Java and Javascript background.
8th Jun 2017, 10:27 PM
Wisdom Abioye
Wisdom Abioye - avatar
+ 1
you don't need curly braces, it's python, therefore you should embrace the python way of doing things
8th Jun 2017, 8:33 PM
Agustin Marinsalda Pastor
Agustin Marinsalda Pastor - avatar
0
No. In Python, the same purpose (delimiting blocks of code) is performed by indentation - all indented lines below the loop start are part of the loop code. While the use of indentation for this purpose is debatable, it does have one advantage - it forces you to keep your code clean and readable :)
9th Jun 2017, 9:33 AM
Bogdan Sass
Bogdan Sass - avatar