dimanche 5 avril 2020

Checking if three inputs form a triangle

So I want to take three inputs from the user and check whether they form a triangle.Now I want my program to check using any three random values of of the given inputs and check whether a + b > c.Here is my code for that :

def check_triangle(a, b, c):
  a, b, c = [float(i) for i in input('Enter the stick lengths: ').split(' ')]
  x, y, z = [int(num) for num in [a, b, c]]
  list_1 = [x, y, z]
  def is_triangle(x, y, z):
    for i in list_1:
      if (list_1[i] <(list_1[i+1] + list_1[i+2])):
        print("Yes")
      else:
        print("No")

check_triangle(a, b, c)

But I am getting no output. What is the error

Aucun commentaire:

Enregistrer un commentaire