I have a problem that requires me to take in a users input and return all items of that value or higher than that value up to 100
im asking the user what grades he wants to see from a set of data that i have.
So i will have the user input a grade and i will return all records of people with that grade or higher.
here is what i have so far
a small sample of the data that im pulling from looks like this
['Bud', 'Abbott', 51, 92.3]
['Don', 'Adams', 51, 90.4]
['Mary', 'Boyd', 52, 91.4]
['Jill', 'Carney', 53, 76.3]
['Hillary', 'Clinton', 50, 82.1]
['Randy', 'Newman', 50, 41.2]
My code so far is just a few if and elif statements making sure the user enters the correct function. This function is going to work so that if the user enters the letter g the program will ask for a grade threshold, and then will return any lines of data with that grade and above.
For example if i were the user, and i input g and then input 90 i would only get back these three lines
['Bud', 'Abbott', 51, 92.3]
['Don', 'Adams', 51, 90.4]
['Mary', 'Boyd', 52, 91.4]
Also if the user enters the letter S it finds the records of that section and returns with all the students in that section so if the user enters s and then 50 the program will return with
['Hillary', 'Clinton', 50, 82.1]
['Randy', 'Newman', 50, 41.2]
the code i have written so far looks like this
def Query ():
input("enter query type (g or s):")
#checks user's input and takes user to grades
if (operator == "g"):
print("You have chosen to query Grades")
GradeThreshold=input("enter the Grade threshold:")
#checks user's input and takes user to section
elif (operator == "s"):
print("You have chosen to query Section")
SectionNumber=input("enter the section:")
elif (operator != "g") and (operator != "s"):
print("Invalid entry. Please re-enter the operation from above.")
return()
I am stumped on how i would take the users input and have it select the range of grades or the section numbers from the list of data i have above. Please help me.