+ 1

Do we need to give semicolon at the end of statement in python??

10th Jan 2019, 11:55 AM
Pranav Jangada
7 Respostas
+ 5
Semicolon aren't required at the end of a statement in Python, but doing so won't hurt. Infact, they can be used to write multiple statements in the same line like a = 5 b = 6 Is equivalent to a = 5 ; b = 6 Some interesting stuff here: https://stackoverflow.com/questions/28883858/python-semicolon-does-make-a-difference
10th Jan 2019, 3:41 PM
R_3-dr
R_3-dr - avatar
+ 3
Echo Echo, that's funny, I didn't know yet that writing the same assignments in one or two lines may make a difference! Although that's probably one of the phenomena we shouldn't rely on when writing code?
10th Jan 2019, 3:46 PM
HonFu
HonFu - avatar
+ 3
Watch out, though, James: Code can get harder to read that way!
10th Jan 2019, 4:17 PM
HonFu
HonFu - avatar
+ 2
Please continue to study your tutorial for a bit! Fundamental questions like these will naturally be answered.
10th Jan 2019, 12:03 PM
HonFu
HonFu - avatar
+ 2
Zen of Python says: Readability counts. PEP8 says: Compound statements (multiple statements on the same line) are generally discouraged.
10th Jan 2019, 6:13 PM
Tibor Santa
Tibor Santa - avatar
+ 1
Experiment. Explore. Don't be afraid to mess up a code by altering it and playing with it. As you go through the lessons write little example codes to try out what you've just learned. Write lots of them. They won't get you up votes and badges but they will give you the experience necessary for the commands, functions and syntax to begin to become second nature. And by experimenting you discover options you may never have found in books or tutorials. Play. Explore. Experiment. Develop! Develop! Develop!
10th Jan 2019, 3:56 PM
James Watkins
James Watkins - avatar
0
Echo Echo thanks for the note on same line multi statements. You just helped me condense some of my programs 🙆
10th Jan 2019, 3:59 PM
James Watkins
James Watkins - avatar