Citizen selector program help
I'm trying to create a "citizen selector" program which basically prompt user to enter 4 inputs, name , health score (0-100), economic output (0-100), and grade(a-f). if they meet conditions like for example if their grade = a and economic output >=85. they shud get a prompt saying they met the criteria. if their health and and economic output =65 and their grade = at least a "c" they meet the criteria how shud I go on doing this. shud I use if statements?
Hello, You can use a few nested ifs (if+elif+else) , every if can have all 4 conditions of your inputs with "and" and "or" . You can also prompt the user to enter a new input after every cycle of the program-making the whole code into a sort of endless loop
Hello, Below are some hints by using if-elif-else loop. First define variables; then use if-elif-else loop with combination conditions as required. Please note that you need to use "int()" to converse score variables into integer, otherwise you cannot compare the result of input() with integer from user's input. # citizen selector program name = input("Please enter your name here: ") health_score = int(input("Please enter your health score: ")) economic_output = int(input("Please enter your economic output here: ")) grade = input("Please enter your grade here: ") if grade == "a" and economic_output >= 85: print("A") elif grade == "b" and economic_output >=65 and economic_output < 85: print("C")
this is what I've done so far. sorry my code looks "amateurish". the bit I'm really struggling with is whenever I enter any letter as my grade, I get an error saying something on the line of "A not defined". can you help me with this . I'm using Python 2.7 by the way https://code.sololearn.com/cnqm1Mt3W9LZ/?ref=app
@jeff ive written the programme above. the issue im having is whenever i get the grade prompt and input a letter i keep getting "grade" is not defined. would you mind helping me with that