Page 96 - TP_V5.1_C8_fb
P. 96

You will get the following output:
                      Output

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




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

                      Program22.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)




                      Output

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




                  Program 23: To perform various list operations.

                      Program23.py
                   File  Edit  Format    Run   Options   Window    Help

                   list1=['o','r','a','n','g','e']
                   print (list1[0])
                   print (list1[2])
                   print (list1[3])
                   list2=["Education",[2,0,2,4]]
                   print (list2[0][1])
                   print (list2[1][3])





                   94   Premium Edition-VIII
   91   92   93   94   95   96   97   98   99   100   101