Page 124 - TP_Play_V2.2_Class8
P. 124

You will get the following output:

                   Output

                str =  Orange Education
                str[0] =  O
                str[-1] =  n



              Program 12: To check whether the side of the triangle given by the user form a scalene, isosceles or
              equilateral triangle


                   Program12.py
               File  Edit  Format    Run   Options   Window    Help

                #Program to check if a triangle is Equilateral, Isosceles or Scalene


                def triangle(A,B,C):
                    if (A == B == C):
                        print('Equilateral triangle')
                    elif ((A == B) or (B == C) or (A == C)):
                        print('Isosceles triangle')
                    else:
                        print('Scalene triangle')
                print('Input the sides of the triangle: ')
                A1 = float(input('A: '))
                B1 = float(input('B: '))
                C1 = float(input('C: '))
                triangle(A1,B1,C1)




              You will get the following output:


                   Output

                Input the sides of the triangle:
                A: 2.3
                B: 5.3
                C: 9.5
                Scalene triangle








                        Factbot

                There are around 700 separate programming languages. Some of the most popular ones are JavaScript,
                Swift, Scala, Python, PHP, Go, Rust, Ruby, and C#.




                  122  Plus (Ver. 4.0)-VIII
   119   120   121   122   123   124   125   126   127   128   129