Page 110 - KEC Khaitan C8 Flipbook
P. 110

Output

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



                  Program 19: To perform various list operations


                      Program19.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])



                  You will get the following output:

                      Output

                   o
                   a
                   n
                   d
                   4






                       REVISIT


                    ▶   A function can be defined as a block of reusable code that performs a specific task.
                    ▶   Python functions can be categorised into built-in functions and user-defined functions.
                    ▶   User-defined functions are created by the user according to the need of the program.
                    ▶   A sequence of characters which is enclosed or surrounded by single (' '), double (" "), or Triple (''' ''') quotes is
                      known as a string.
                    ▶   Single-line string can be created by enclosing characters inside single or double quotes.
                    ▶   A multiline string in Python begins and ends with either three single quotes or three double quotes.
                    ▶   In Python, a list is a type of container that is used to store a list of values of any type.










                  108   Premium Edition-VIII
   105   106   107   108   109   110   111   112   113   114   115