How to make them display on separate lines? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to make them display on separate lines?

In my code [[["Enter a number: " and "Enter another number: " ]]] is displayed on the same line and the answer of the operation is displayed next to them. Can anyone suggest how to make them look neat and clean? *U can understand better once u run my code* 👇 https://code.sololearn.com/cgLrR0vd216a/?ref=app

5th Jul 2020, 3:27 PM
Yusuf Ansari
Yusuf Ansari - avatar
8 Answers
+ 3
a=int(input("Enter a number:\n ")) b=int(input("Enter another number:\n ")) print(a+b) # \n is used for line break
5th Jul 2020, 3:30 PM
Arctic Fox
Arctic Fox - avatar
+ 2
Use the \n code to add a line break. Simply by string concatenation + "\n" +
5th Jul 2020, 3:28 PM
ElitoGame
ElitoGame - avatar
+ 2
It's simple. Just use "/n" there
6th Jul 2020, 5:37 PM
Arctic Fox
Arctic Fox - avatar
+ 1
Just add a new line break after both input-messages (\n).
5th Jul 2020, 3:29 PM
Sandra Meyer
Sandra Meyer - avatar
0
Okay.... Thanks to all , it worked 😊
5th Jul 2020, 3:36 PM
Yusuf Ansari
Yusuf Ansari - avatar
0
But what if I want to add at the end as "The answer is - " How to do this?
5th Jul 2020, 3:42 PM
Yusuf Ansari
Yusuf Ansari - avatar
0
Anyone???
6th Jul 2020, 5:30 PM
Yusuf Ansari
Yusuf Ansari - avatar
0
No bro , i asked - What if I want to add at the end as "The answer is - " How to do this?
6th Jul 2020, 5:38 PM
Yusuf Ansari
Yusuf Ansari - avatar