0
Outputs in different line using single print statement...
I have 2 variables, I want to print sum, difference and product of those variables in 3 different line using only one print statement.....Print(x+y, x-y, x*y) is giving results in same line
9 odpowiedzi
+ 3
Some of these may be helpful https://www.sololearn.com/Discuss/821134/?ref=app
+ 2
print(x+y, x-y, x*y, sep='\n')
+ 1
yes it worked....tq so much.....I'm beginner trying with simple programs
+ 1
print has predefined that each word is separated by a white space and that in the end there's a newline.
If you want something else, you can write sep='anystringyouwant' and end='anystringyouwant'.
Example:
print('apples', 'pears', 'bananas', sep=' or ', end='!')
-> apples or pears or bananas!
0
@HonFu
syntax error :(
0
Try again - I've corrected a typo!
0
Great....got it.....please recommend me videos or free online courses or books for beginners
0
I don't know English videos or books (I am from Germany). Maybe someone else can help out?
0
Thanks @David