mercredi 16 mai 2018

Why is my if statement not working with strings in it? [duplicate]

This question already has an answer here:

I'm having some problems with the second if statement. When I ask the user to input Yes/yes if they want the working out, it always comes out as yes, even when I input No/no

if equation == 1:
    print()
    print()
    print(equationchosen, "The Sine Rule - Finding Sides", sep = "")
    A1 = float(input("Enter the opposite angle of the wanted side: "))
    b1 = float(input("Enter the known side(opposite of the known angle): "))
    B1 = float(input("Enter the known angle(opposite if the known side): "))
    dps1 = int(input("Enter the decimal places you want to have for the answer: "))
    print()
    a1 = (sin(radians(A1)) * b1) / sin(radians(B1))
    print()
    print()
    print("Answer= ", round(a1, dps1), " units(", dps1, end = "d.p)", sep = "")
    if input("Do you want the working Out? ") == "Yes" or "yes":
        print("Solution: x/sin(", A1, "°) = ", b1, "/sin(", B1, "°)", sep = "")
        print(" " * Solutiongap, "x = (", b1, " * sin(", A1, "°)) / sin(", B1, "°)", sep = "")
        print()
        print("Answer= ", round(a1, dps1), " units(", dps1, end = "d.p)", sep = "")
    break

Aucun commentaire:

Enregistrer un commentaire