- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How do we write Multi-Line Statements in Python?
In Python, the preferred way of wrapping long expression over multiple lines is to put it inside parentheses
a=(10**2+ 10*5 -10) print (a)
This will result in 140.
Another way is to use line continuation character
b=1+ \ 2 + \ 3 print (b)
Note that even if items in List, Tuple or Dictionary object span over multiple lines, the line continuation character is not needed.
- Multi-Line Statements in Python
- How to execute Python multi-line statements in the one-line at command-line?
- How to write multi-line comment in Java?
- How to write multi-line comments in C#?
- How to style multi-line conditions in 'if' statements in Python?
- How can we combine multiple print statements per line in Python?
- Multi-Line printing in Python
- How do we access command line arguments in Python?
- How do we use nested switch statements in C#?
- How do we use nested if statements in C#?
- How do we use multi-dimensional arrays in C#?
- In MySQL, how we can write Multiple-line statement?
- How do I split a multi-line string into multiple lines?