Why was ; (semicolon)used in a python? sololearnGame | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why was ; (semicolon)used in a python? sololearnGame

I was playin the sololearn game with python. why was " ; " used ?

26th Jan 2020, 5:23 PM
gun
gun - avatar
5 Answers
+ 6
Normally used to create errors and dumping code u can write more than one statement in one line also some javaists cant let it go.
26th Jan 2020, 5:42 PM
Oma Falk
Oma Falk - avatar
+ 1
Can you show us the specific piece of code?
26th Jan 2020, 5:28 PM
HonFu
HonFu - avatar
+ 1
Writing a semicolon in Python is nonsense. In other languages, like C, Java, C# etc., a semicolon marks the end of the statement. That gives them freedom to deal with whitespace as they want. In Python, whitespace determines what belongs to what, but you don't need {} or semicolon. ; in Python makes sense *only* if you insist on writing several statements in one line. print(1); print(2)
26th Jan 2020, 5:44 PM
HonFu
HonFu - avatar
+ 1
Yeah, ^ agree. That got me confused. shouldn't use diff languages habits in python.
26th Jan 2020, 5:47 PM
gun
gun - avatar
0
At the end of line of codes .. arr = list(range(15)); print(arr); False; etc
26th Jan 2020, 5:34 PM
gun
gun - avatar