How do we write Multi-Line Statements in Python?
Answers
Answered by
0
i dont know but please follow me
Answered by
0
Usually, every Python statement ends with a newline character. However, we can extend it over to multiple lines using the line continuation character (\).
And Python gives us two ways to enable multi-line statements in a program.
Explicit Line Continuation
When you right away use the line continuation character (\) to split a statement into multiple lines.
Example
# Initializing a list using the multi-line statement
>>> my_list = [1, \
... 2, 3\
... ,4,5 \
... ]
>>> print(my_list)
[1, 2, 3, 4, 5]
Similar questions