Reputation: 15
If the given number is less than the 2, it asks to reenter the number by using recursion.
I've first given 2 and then after recursion, I gave 3, but the output is still 2.
How to output 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())
Upvotes: 0
Views: 49
Reputation: 33032
Currently you don't save the return value from inexpno()
in the recursive call on line 8. You simply need to save it as exp
:
exp = inexpno()
Upvotes: 1