Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
I need help
#1
Hello. I am new to using python!
I am using python version 3!
The question I need help with is;
Write a program that accepts the lengths of three sides of a triangle as inputs. The program output should indicate whether or not the triangle is an equilateral triangle
Here is the code I have been using;
# print("Input lengths of the triangle sides: ")

x = int(input("x: "))

y = int(input("y: "))

z = int(input("z: "))

if x == y == z:

    print("Equilateral triangle")

else:

    print("Not Equilateral triangle")
The problem I am having is when I go to test it it says 2/3 and it is saying that I am failing the equilateral test.

X=5
Y=5
Z=5
Reply
#2
Your code is correct as posted. Debug it by printing x, y, and z. If you are getting "2/3" then you are running something other than what is posted here.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020