Python Multi-line Statements:
- Python already contains a lot of advanced features and functions to make programming easy to understand.
- Similarly, python gives us an option to make multiple line statements into a single line statement.
- There are two options to implement this concept, one is with the help of a backward slash and another way is using Parenthesis/square bracket/curly bracket.
Table Of Contents
01. Example
Using Backward Slash(Number).
data = 10 + 20 + 30 + 40 + 50 + 60 print(data)
Output
210
02. Example
Usign Square Brackets(On String).
stringData = "This is mutiple line statement" print(stringData)
Output
This is mutiple line statement
03. Example
Using Parenthesis Brackets.
data = (10 + 20 + 30 + 40 + 50 + 60) print(data)
Output
210
04. Example
Usign Curly Brackets.
newStringData = {'This is ' 'new mutiple line ' 'statement'} print(newStringData)
Output
This is new mutiple line statement