如果给定的数字小于2,它会要求使用递归重新输入数字
我首先给出了2,然后在递归之后,我给出了3,但是输出仍然是2
如何输出3
def inexpno():
exp = int(input("Enter the Experiment n.o : ")) # Takes a exp number
if exp<=2: # Enter your completed experiment here
print("It is completed Correction for both Record and Observation\n\n")
print("Do you want to select another experiment")
we = input("")
if we == "yes" or we == "YES":
inexpno() # TO CHANGE
else:
exit()
return exp
print(inexpno())
目前,您没有在第8行的递归调用中保存来自
inexpno()
的返回值。您只需将其保存为exp
:把递归行改成
相关问题 更多 >
编程相关推荐