+ 4
So we don't use semicolons in python. How python understands that one statement ends ?
5 odpowiedzi
+ 14
Python is an interpreted language, it is made so as to carry out each line at a time(interpreted as you type)and not fully compile and run as languages like C++ do.
That said,
Every line in python code acts as a new line/statement
thus when you write
print("Hello")
print("World!!")
these two will be printed on different lines as they are written on different lines...
+ 10
Oh thanks @Eric, didn't knew about the default keyword argument... 🤔😉
+ 6
Also, Python allows you to put two statements on one line if you separate them with a semicolon. E.g
arr = [] ; count = 0
is permissible, if bad style.
One minor quibble about Frost's otherwise good answer. The output of two print statements occur on separate lines because of the default keyword argument end='\n' . If you define end=' ', then the two print statements will print on the same line.
+ 2
Python interpret each new line as a separate line of code
Thanks to its complex structure, which makes one easier to code in python
+ 2
Take an example:
https://code.sololearn.com/cGkqOCJrPbOr/?ref=app