+ 6
How to make it in two line
I can make it two line by using print(a) and print (b). I need to use two time print function. But how i make it by using one time print function? https://code.sololearn.com/cdcltt2vt8M9/?ref=app
28 Answers
+ 1
Is this it?
https://code.sololearn.com/cE3bEg3eU3Ve/?ref=app
+ 5
Prakash Dhar would something like this works better
a= input()
b= input()
print((f"""{a}
{b}"""))
+ 4
By default, print statements add a new line character(\n) whereas input functions don't.
So, you need to use a `\n` at the end of each input prompt message to break lines.
a = input("first number:\n")
b = input("secound number:\n")
print (a+'\n'+b)
+ 4
Ratnapal Shende
https://www.python.org/dev/peps/pep-0498/
+ 3
https://code.sololearn.com/cisjnbM7A91W/?ref=app The actual program written in two lines?
+ 2
HungryTradie i want...
First number : 45
Secound number : 54
Like this
+ 2
G'day Prakash Dhar did you see the answer by Josh ?
Whilst my answer may work, it is from my knowledge of coding in C. Josh has a much more correct answer for Python coding. Please learn it the way he showed.
+ 2
print (a,"\n",b)
the \n is an special character for inserting a new line
+ 1
Simba bro just explained read again
+ 1
HungryTradie i tried and its look like...
First number: secound number :
45
45
+ 1
HungryTradie i already tried it on my own. I just want it by using one time print function Thanks
+ 1
BroFar
where i can learn about this new f-string triple qoutes syntax ?
please provide the best source
print(f"""{a} {b}""")
+ 1
Prakash Dhar
# Created by SK
a= input("first number:")
print(a,("\n"))
b= input("second number:")
print(b,("\n"))
#b= input("secound number:")
print ("Sum is",(int(a)+int(b)))
#print(a+b)
#0.0.0.0
0
Jay Matthews i tried your methods but still in one line
https://code.sololearn.com/cdcltt2vt8M9/?ref=app
0
Post your question clearly like how do i display the output of two numbers in one line
Your question is how do I print two variables in one line
0
notstacked i want to make it in two line. Josh methods is working. But whats wrong with mine? I simply follow the rules. It didnt work. I tried Jay Matthews one. But still no luck
0
I want to make it in two line what ??
1.Take 2 inputs in one line ?
Or
2.Print value of those two variables in one line using print function ?
Or
3.Display value of those two nos in one line ?
Or some combination of 1,2,3
0
notstacked 2. Print those two variables in two line. not in one line. like
first number :
secound number :