Page 132 - 2620_Birla Open Mind C-8
P. 132

Interdisciplinary Learning

                         #Mathematics

                 Create a Python program to find the HCF and LCM of two numbers using function.

                                                                                                         #Lab Activity



                   STRING


              A sequence of characters which is enclosed or surrounded by single (‘ ’), double (“ ”), or tipple (''' ''') quotes
              is known as a string. The sequence may include a letter, number, special characters or a backslash.
              Python treats single quotes as double quotes.
                                                                               Output
              Example of a string:
                                                                            This is Shweta's pen.
              str = 'This is Shweta\'s pen.'
              print (str)

              Creating a Single-line String

              Single-line  String  can  be  created by  enclosing  characters inside  single  or  double  quotes.  It  is  like
              assigning a value to a variable.

              Example of a string:

              message = 'This is a single line string.'
              print(message)
              Program 3: To create a single-line string

                   Program3.py

                File  Edit  Format   Run   Options   Window    Help

                first_name = 'Aadya'

                print (first_name)
                last_name = 'Kaushal'

                print (last_name)
                str = ' '
                print (str)






                  Output
                Aadya
                Kaushal








                  130  Premium Edition-VIII
   127   128   129   130   131   132   133   134   135   136   137