dimanche 27 septembre 2020

Creating a funciton that prints the result of if-statements

I want to create a function that will compare some values that I calculated (and placed in a list called abv_list_round) and compare them to some values that other people have calculated. I set up a for loop with an if statement nested inside of it, and it doesn't return any errors, but it also doesn't print any of the statements I asked it to. Do I need the function to return each of those statements? Or should I try saving them all to a list and returning that instead?

Here's what I have so far:

def resolve(x = grad1, y = grad2):
    find_abv(SG = SG_val, FG = FG_val)
    for i in abv_list_round:
        if abv_list_round == x:
            print("Grad student 1 is correct")
        elif abv_list_round == y:
            print("Grad student 1 is correct")
        else: 
            print("you were both wrong")

Aucun commentaire:

Enregistrer un commentaire