如何打印值列表?

时间:2016-04-01 21:02:47

标签: python

print("Hello. Please Proceed to Enter a Range of Numbers")
first = int(input("please enter the first number in the range: "))
last = int(input("please enter the last number in the range: "))

numlist=list(range(first,last)

我在解析时遇到了预期的错误。当我添加print(numlist)时 它增加了一个额外的错误。

1 个答案:

答案 0 :(得分:0)

print("Hello. Please Proceed to Enter a Range of Numbers")
first = int(input("please enter the first number in the range: "))
last = int(input("please enter the last number in the range: "))

numlist=list(range(first,last)) #FTFY
for x in numlist:
   print(x)

基本上这是做什么的,在声明numlist之后,它遍历它并打印出新行上的每个值

你的主要问题是你错过了numlist声明中的第二个RPAREN