+ 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

2nd Mar 2022, 5:48 AM
Apu
Apu - avatar
28 ответов
2nd Mar 2022, 5:59 AM
👑 ShadowCipher 🇦🇲
👑 ShadowCipher 🇦🇲 - avatar
+ 5
Prakash Dhar would something like this works better a= input() b= input() print((f"""{a} {b}"""))
2nd Mar 2022, 7:07 AM
BroFar
BroFar - avatar
+ 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)
2nd Mar 2022, 6:36 AM
Simba
Simba - avatar
+ 4
Ratnapal Shende https://www.python.org/dev/peps/pep-0498/
3rd Mar 2022, 11:39 AM
👑 ShadowCipher 🇦🇲
👑 ShadowCipher 🇦🇲 - avatar
2nd Mar 2022, 7:02 AM
👑 ShadowCipher 🇦🇲
👑 ShadowCipher 🇦🇲 - avatar
+ 3
https://code.sololearn.com/cisjnbM7A91W/?ref=app The actual program written in two lines?
2nd Mar 2022, 9:21 PM
Gurseerit Singh Chahal ✓
Gurseerit Singh Chahal ✓ - avatar
2nd Mar 2022, 6:40 AM
notstacked
+ 2
HungryTradie i want... First number : 45 Secound number : 54 Like this
2nd Mar 2022, 7:02 AM
Apu
Apu - avatar
+ 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.
2nd Mar 2022, 9:48 AM
HungryTradie
HungryTradie - avatar
+ 2
print (a,"\n",b) the \n is an special character for inserting a new line
2nd Mar 2022, 1:41 PM
Pythøñ Cúltîst⚔️🔥🇳🇬
Pythøñ  Cúltîst⚔️🔥🇳🇬 - avatar
+ 1
Simba bro just explained read again
2nd Mar 2022, 6:43 AM
notstacked
+ 1
HungryTradie i tried and its look like... First number: secound number : 45 45
2nd Mar 2022, 6:59 AM
Apu
Apu - avatar
+ 1
HungryTradie i already tried it on my own. I just want it by using one time print function Thanks
2nd Mar 2022, 7:23 AM
Apu
Apu - avatar
+ 1
BroFar where i can learn about this new f-string triple qoutes syntax ? please provide the best source print(f"""{a} {b}""")
3rd Mar 2022, 11:32 AM
Ratnapal Shende
Ratnapal Shende - avatar
+ 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
3rd Mar 2022, 9:38 PM
Sanjay Kamath
Sanjay Kamath - avatar
0
Jay Matthews i tried your methods but still in one line https://code.sololearn.com/cdcltt2vt8M9/?ref=app
2nd Mar 2022, 6:04 AM
Apu
Apu - avatar
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
2nd Mar 2022, 6:15 AM
notstacked
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
2nd Mar 2022, 6:19 AM
Apu
Apu - avatar
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
2nd Mar 2022, 6:28 AM
notstacked
0
notstacked 2. Print those two variables in two line. not in one line. like first number : secound number :
2nd Mar 2022, 6:30 AM
Apu
Apu - avatar