Below is my code. Instead of getting the smallest value entered by user, i get the last inputted value. I am a beginner so taking baby steps to lean python. Any leads is appreciated. Thanks
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
largest = None smallest = None while True : num = input ( "enter a number" ) if num = = 'done' : break try : val = int (num) except : Print ( "error" ) continue if smallest is None : smallest = val elif : val<smallest smallest = val Print ( "smallest" , val) |