What is the use of " ; " in python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 9

What is the use of " ; " in python

23rd Dec 2020, 11:53 PM
Melekte Petros
Melekte Petros - avatar
7 Answers
+ 5
x=int(input()); y=int(input()); print(x+y); that was Python code why work that code try it
24th Dec 2020, 12:15 AM
Melekte Petros
Melekte Petros - avatar
+ 5
10ks
24th Dec 2020, 12:26 AM
Melekte Petros
Melekte Petros - avatar
+ 2
Melu Pitor x = 5; y = 10; sum = x+y; print(sum) is the same with: x = 5 y = 10 sum = x+y print(sum)
24th Dec 2020, 2:49 AM
noteve
noteve - avatar
+ 2
Melu Pitor, u can use ";" to write multiple statements in a single line - In python its reduntant to put semicolon at the end of multiple statements in multiple lines (unlike c++)
24th Dec 2020, 6:47 AM
A C K
A C K - avatar
0
It is used to separate code, they generally are not required, but they can be used to make one liners or shrink code https://code.sololearn.com/cljy1zAqvkis/?ref=app https://code.sololearn.com/cGk62H723O0u/?ref=app
24th Dec 2020, 12:23 AM
Steven M
Steven M - avatar
0
we can use ";" to write multiple codes in single line like a=2 b=3 we can assign the values for both a and b in the single line as given below a=2;b=3
24th Dec 2020, 9:23 AM
Mitta Mukesh Kumar
Mitta Mukesh Kumar - avatar
0
"" it means that your code is string
25th Dec 2020, 2:48 PM
ARNAV SINGH
ARNAV SINGH - avatar