codedex-io/python-101

Multiple houses

Closed this issue ยท 1 comments

As designed, choosing options such as: 1, 3, 4 on each question respectively, would result in both Gryffindor and Ravenclaw having the same weight in determining one's house. Maybe swap the last bit, that evaluates the winning house, to something like...

if(ravenclaw > gryffindor and ravenclaw > slytherin and ravenclaw > hufflepuff):
    print("Ravenclaw!")
elif(gryffindor > ravenclaw and gryffindor > slytherin and gryffindor > hufflepuff):
    print("Gryffindor!")
elif(slytherin > ravenclaw and slytherin > gryffindor and slytherin > hufflepuff):
    print("Slytherin!")
elif(hufflepuff > ravenclaw and hufflepuff > gryffindor and hufflepuff > slytherin):
    print("Hufflepuff!")
else:
    print("Multiple houses.")

Granted your code will still spit out one winner, but I feel like it could be confusing to some as to why Gryffindor is taking priority over Ravenclaw, when they have the same amount of points. Especially since Ravenclaw should win. ๐Ÿ˜

This is overkill but precise.

if Gryffindor == Hufflepuff == Slytherin == Ravenclaw:
    print("It's a tie! choose between: ๐Ÿฆ Gryffindor, ๐Ÿฆ… Ravenclaw, ๐Ÿ Slytherin & ๐Ÿฆก Hufflepuff") 
elif Gryffindor > Hufflepuff:
    if Gryffindor > Slytherin:
        if Gryffindor == Ravenclaw:
            print("It's a tie! choose between: ๐Ÿฆ Gryffindor & ๐Ÿฆ… Ravenclaw")
        elif Gryffindor > Ravenclaw:
            print("Your house is: ๐Ÿฆ Gryffindor!")
        else:
            print("Your house is: ๐Ÿฆ… Ravenclaw!")
    elif Slytherin > Ravenclaw:
        print("Your house is: ๐Ÿ Slytherin!")
    else:
        print("Your house is: ๐Ÿฆ… Ravenclaw!")
elif Hufflepuff > Ravenclaw:
    if Hufflepuff == Slytherin:
        print("It's a tie! choose between: ๐Ÿฆก Hufflepuff & ๐Ÿ Slytherin")
    elif Hufflepuff > Slytherin:
        print("Your house is: ๐Ÿฆก Hufflepuff!")
    else:
        print("Your house is: ๐Ÿ Slytherin!")
elif Ravenclaw > Slytherin:
    print ("Your house is: ๐Ÿฆ… Ravenclaw!")
else: 
    print("Your house is: ๐Ÿ Slytherin!")