我正在用数字做一个字符串计算器。例如:
154 + 246 = 154246
因此,用户将输入一组数字,使用
\n
.如你所知,
\n
用于生成新行,但我需要使用at作为任何普通字符串。我需要使用
\n
代码:
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()