Programming Tip -How can we combine multiple print statements per line in Python?
<p dir="auto"><img src="https://images.hive.blog/768x0/https://steemitimages.com/DQmW2uViAfWVSCc4NRmA38Gv1zVQJwsz2ELN2xYq7UzMEga/EBOOK_PYTHON_no-name.png" alt="EBOOK_PYTHON_no-name.png" srcset="https://images.hive.blog/768x0/https://steemitimages.com/DQmW2uViAfWVSCc4NRmA38Gv1zVQJwsz2ELN2xYq7UzMEga/EBOOK_PYTHON_no-name.png 1x, https://images.hive.blog/1536x0/https://steemitimages.com/DQmW2uViAfWVSCc4NRmA38Gv1zVQJwsz2ELN2xYq7UzMEga/EBOOK_PYTHON_no-name.png 2x" />
<hr />
<blockquote>
<p dir="auto">Today i am going to show Programming Tip - How can we combine multiple print statements per line in Python<br />
with simple code. I hope you will understand this.<br />
If you have any query you can ask.<br />
i hope you will like it.<br />
<br /><br />
<pre><code>Python2.x
print "Hello",
print " world"
Python3.x
print ("Hello", end='')
print (" world")
This will give the output:
Hello world
Another thing you could do is put all the things in an array and call ''.join(array). For example,
arr = ["Hello", "world"]
print(' '.join(arr))
This will give the output:
Hello world
<p dir="auto"><center>
<p dir="auto"><br /><br />========================================================= <span>Follow me at : <a href="https://steemit.com/@ahmadhassan" target="_blank" rel="nofollow noreferrer noopener" title="This link will take you away from hive.blog" class="external_link">https://steemit.com/@ahmadhassan
<p dir="auto"><span><img src="https://images.hive.blog/0x0/https://steemitimages.com/DQmYfKYGX2M8Qc8nNUi6TqUzHKoeLmafZ6PVBMjt7wjXe5R/99.gif" /> <br />
Thanks for reading and always welcome your suggestions :)
=========================================================
I like using
'''
for multi-line prints :)that's great. every programmer has own way to program. :) Thanks for your feedback
This post has received a 1.33 % upvote from @booster thanks to: @ahmadhassan.