Programming Tip -How can we combine multiple print statements per line in Python?
Today i am going to show Programming Tip - How can we combine multiple print statements per line in Python
with simple code. I hope you will understand this.
If you have any query you can ask.
i hope you will like it.
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
Follow me at : https://steemit.com/@ahmadhassan
=========================================================
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.