您现在的位置是:主页 > news > 大连旅游网站建设大概多钱/seo做的好的网站
大连旅游网站建设大概多钱/seo做的好的网站
admin2025/5/11 5:10:03【news】
简介大连旅游网站建设大概多钱,seo做的好的网站,计算机类哪个专业前景好,semen我有一个小脚本,我一直在用Python练习。我很难让我的输入接受if语句的数字和接受小写的字符串。在我想告诉我的脚本,如果用户输入99然后关闭程序。到目前为止,它在我有int(input())的地方工作,但在我有input()的地方就不行了。我做…
我有一个小脚本,我一直在用Python练习。我很难让我的输入接受if语句的数字和接受小写的字符串。在
我想告诉我的脚本,如果用户输入'99'然后关闭程序。到目前为止,它在我有int(input())的地方工作,但在我有input()的地方就不行了。我做错了什么?还是我无能为力?在
现在我的if语句如下:if choice1 == 99:
break
我是不是应该通过引用把99变成一个字符串?在
也许是这样的:
^{pr2}$
脚本如下:global flip
flip = True
global prun
prun = False
def note_finder(word):
prun = True
while prun == True:
print ('\n','\n','Type one of the following keywords: ','\n','\n', keywords,)
choice2 = input('--> ').lower()
if choice2 == 'exit':
print ('Exiting Function')
prun = False
start_over(input)
elif choice2 == 99: # this is where the scrip doesnt work
break # for some reason it skips this elif
elif choice2 in notes:
print (notes[choice2],'\n')
else:
print ('\n',"Not a Keyword",'\n')
def start_over(word):
flip = True
while flip == True:
print ('# Type one of the following options:\n# 1 \n# Type "99" to exit the program')
choice1 = int(input('--> '))
if choice1 == 99:
break
elif choice1 < 1 or choice1 > 1:
print ("Not an option")
else:
flip = False
note_finder(input)
while flip == True:
print ('# Type one of the following options:\n# 1 \n# Type "99" to exit the program')
choice1 = int(input('--> '))
if choice1 == 99:
break
elif choice1 < 1 or choice1 > 1:
print ("Not an option")
else:
flip = False
note_finder(input)