Issue
So what is the use of the semicolon (;
) in python? All it does is separate multiple statements. I can't seem to find any practical use for the semicolon. If you are going to use a semicolon, then why not just put the multiple statements on multiple lines? If you want to define multiple variables on one line, you could always do: x, y = 0, 1
or something along those lines. The only time I can find a use for this is if you are using the terminal and you want to execute a command in python (for instance: python3 import random; print(random.randint(1, 10))
). Even now, you can always use the python shell with python3
and then execute the code you want. It would be greatly appreciated if someone could show me a practical example of a semicolon.
Thanks!
Solution
It basically just denotes separation and is a leftover from older programming languages.
Answered By - nomeal
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.