Jul-17-2018, 03:36 AM
It's one thing to tell someone we have reached the end of a list, but how do we tell the user if no matches were found?
#!/usr/bin/env python3 #PracticePythonExercise03.py myList = [0,2,5,4,6,7,9,8] userNumber = int(input("Pick a number: ")) print("the numbers in myList that are smaller than the number you entered are:") for i in myList: if i < userNumber: print("Found a number less than " + userNumber + " which is: " + i) #If there are no numbers in myLsit smaller than userNumber, then tell the user if i == len(myList) and no i < userNumber has not been found...