Page 71 - TP_Prime_V2.2_Class7
P. 71

Sometimes, we have to use operators with strings also based on our needs. Python allows
                 two arithmetic operators to be used with strings. These are (+) to concatenate the strings

                 and (*) to reprint the string value. Let us see the example below:






 Prime (Ver. 2.2)-VII                                                                                                       MORE ON PYTHON











                                                    Using (+) Concatenation Operator



 68                   Warm           Write the output of these Python commands:                  Century   #Critical Thinking  69
                                                                                                   21 st
                      Up!            1.  print(100*34)  ____________________                       Skills


                                     2.  print(“100%6”)  ____________________

                                     3.  print(“100”*5)  ____________________




                 Program 1: To find the area and perimeter of a square whose side is entered by the user.



















                 Program 2: To print the value entered by the user for 7 times.
   66   67   68   69   70   71   72   73   74   75   76