0

How do I move a variable to a new line within a while loop?

I'm learning python and I used a variable to store user input. I need the output to be on a new line repeatedly. I've tried using the \n command before the variable but it brings up an error every time

5th Apr 2022, 12:25 PM
Eke Ezinne
3 Respostas
+ 1
Can you share your try..?
5th Apr 2022, 12:34 PM
Jayakrishna 🇮🇳
0
Hi! \n is a character (a string data type). If your variable is a string, you can concatenate the variable with the new line character \n before you print it out. Otherwise convert the data type in your variable to a string before you concatate it with the new line character. Another way is to print out your variable and the new line characters a two output arguments in the same print function, seaparated with a comma sign.
5th Apr 2022, 1:21 PM
Per Bratthammar
Per Bratthammar - avatar
- 1
Let's see your code
5th Apr 2022, 12:53 PM
Chigozie Anyaeji 🇳🇬
Chigozie Anyaeji 🇳🇬 - avatar