mercredi 11 septembre 2019

How to fix if/else statement

Program won't execute else command

print ('This program will determine if three angles can form a triangle') print ('Enter Angle 1') degree1=input()

print ('Enter Angle 2') degree2=input()

print ('Enter Angle 3') degree3=input ()

degrees= int(degree1+degree2+degree3)

if (degrees>180): print ('Yes it does form a triangle as these angles are equal to 180')

else: print ('No, it does not form a triangle as these angles are less than 180')

Printing Yes it does form a triangle as these angles are equal to 180 regardless of the numerical values entered.

Aucun commentaire:

Enregistrer un commentaire