- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- 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 can we combine multiple print statements per line in Python?
You can combine multiple print statements per line using, in Python 2 and use the end argument to print function in Python 3.
example
Python2.x print "Hello", print " world" Python3.x print ("Hello", end='') print (" world")
Output
This will give the output −
Hello world
Another thing you could do is put all the things in an array and call ''.join(array).
example
arr = ["Hello", "world"] print(' '.join(arr))
Output
This will give the output −
Hello world
Advertisements