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
3 Answers
+ 1
Can you share your try..?
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.
- 1
Let's see your code