I am making a string calculator using numbers. For example:
154 + 246 = 154246
So the user will enter an input of a group of numbers, to separate the numbers using \n. As you know, \n is used to make a new line, but I need to use at as any normal string. I need to separate the numbers using \n into a list.
Code:
num_list = []
# this function will add a number to the list
def ask_num():
# ask for a number (we will make it a string so we can add comma and /n)
num = input("Enter numbers: ")
# run the function for asking numbers
ask_num()
>Solution :
You can use
r"\n"
or
"\\n"