Page 118 - TP_Play_V2.2_Class8
P. 118

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 Strings

              Single-line  Strings  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















                  116  Plus (Ver. 4.0)-VIII
   113   114   115   116   117   118   119   120   121   122   123