- 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
Print Single and Multiple variable in Python?
To easily display single and multiple variables in Python, use the print() statement. For multiple variables, use the comma operators.
Variables are reserved memory locations to store values. It means that when you create a variable, you reserve some space in the memory.
Based on the data type of a variable, the interpreter allocates memory and decides what can be stored in the reserved memory. Therefore, by assigning different data types to the variables, you can store integers, decimals or characters in these variables.
Print Single Variable in Python
To display a single variable, simply use the print() method −
Print Multiple Variables in Python
To display multiple variables, simply use the print() method. Set the variables using the comma operator −
print(5, 10, 15) print((10, 20, 30, 40, 50))
5 10 15 (10, 20, 30, 40, 50)
Print multiple variables on the same line using the end parameter
To display multiple variables, use the print() method. To set the variables from multiple print() in a single line, use the end operator −
print(5, 10, 15, end=" ") print(10, 20, 30, 40, 50)
5 10 15 10 20 30 40 50
- Print Single and Multiple variable in C#
- Print Single and Multiple variables in Java
- Multiple Assignments to Single Value in Python
- Difference Between Single and Multiple Inheritance
- What are single row and multiple row subqueries?
- How can we print multiple blank lines in python?
- C# Multiple Local Variable Declarations
- How to assign multiple values to a same variable in Python?
- How to print double quotes with the string variable in Python?
- Multiple COUNT() for multiple conditions in a single MySQL query?
- Select multiple columns and display in a single column in MySQL?
- Print newline in PHP in single quotes
- How to provide multiple statements on a single line in Python?
- Concatenate multiple rows and columns in a single row with MySQL
- How can we combine multiple print statements per line in Python?