Page 222 - Robotics and AI class 10
P. 222

On running the above program, you will get the following output:















                 Difference between List and Tuple



                                   List                                          Tuple

              A list is a sequence of multiple values in an ordered  A tuple is a collection of objects which is ordered.
              sequence.

              List is enclosed in square brackets [].        Tuples are enclosed in parenthesis ().

              Elements of the list can be changed.           Elements of the tuple cannot be changed.

              List has the variable length.                  Tuple has the fixed length.

              List is mutable.                               Tuple is immutable.

              List can hold only homogeneous values.         Tuple can hold both homogeneous and
                                                             heterogeneous values.



                 Some More Programs

        Program 11: To print the entire tuple.















        On running the above program, you will get the following output:


















              220     Touchpad Robotics & Artificial Intelligence-X
   217   218   219   220   221   222   223   224   225   226   227