2024-04-20 12:45:57 发布
网友
当我输入这个:
def tablesUsed(): "Return which multiplication tables to use" tablesUsed = [int(x) for x in input("Please choose which multiplication tables you wish\nto practice, then type them like this: 2 5 10.\n").split()]
python跳过函数到下一行。怎么回事?在
你得给它打电话。在
tablesUsed()
您可能还想实际返回列表。在
否则,您将无法访问在函数中创建的列表,使其变得无用。在
另外,如果您使用的是python2,input()将输入作为Python代码进行计算,您很可能会得到一个错误。使用raw_input()返回字符串。在Python 3中,raw_input()被删除并被input()替换
input()
raw_input()
你得给它打电话。在
您可能还想实际返回列表。在
^{pr2}$否则,您将无法访问在函数中创建的列表,使其变得无用。在
另外,如果您使用的是python2,
input()
将输入作为Python代码进行计算,您很可能会得到一个错误。使用raw_input()
返回字符串。在Python 3中,raw_input()
被删除并被input()
替换相关问题 更多 >
编程相关推荐