【发布时间】:2020-02-20 19:04:06
【问题描述】:
import sys
我无法检查此导入是否有效,因为代码本身不起作用
options_list = [1,2,3]
def options(options_list):
print ("\n1. Hypotenuse solver \n2. Scat jazz \n3. Exit")
print ("Enter the number of the option you would like")
option = input()
return option
option = options(options_list)
while option not in options_list:
option = options(options_list)
if option in options_list:
if option == 1:
print ("...")
我稍后会添加这个,希望
elif option == 2:
print ("Scoobidibahbahbah")
elif option == 3:
sys.exit
这是一个学校项目,带有菜单的斜边求解器
【问题讨论】:
-
请格式化代码 - 选择它并输入
ctrl-k。 .. Formatting help ... more Formatting ... Formatting sandbox -
这能回答你的问题吗? How can I read inputs as numbers?
-
将您的代码粘贴到我的编辑器中会导致以下警告:阴影名称“options_list”来自外部范围,参数“options_list”值未使用.
-
想必你是这样写的。你到底有什么问题?
标签: python function python-import