Page 141 - 2622_Delhi Police Public School_C-8
P. 141

5.   What is the difference between the string concatenation operator and the string replication operator?
                           Explain with an example.










                        Scratch Your Brain.                                                       21 st  Century   #Critical Thinking
                                                                                                      Skills
                                    1.  Write the output of the following programs:

                            a.   print("Hello")

                               print("i love"+ "python\n\n
                              and enjoy doing it.")

                             b.  fruit='mango'

                              fruit1=fruit.upper()

                              print(fruit1*3)

                             c.  car='ferrari'

                              print(car.upper())

                              print(car.lower())

                              print(len(car))

                              print(car.capitalize())
                             d.  def total(a,b):


                                    sum=a+b

                                    print(sum)

                              total(14,16)
                             e.  def Name(fname,lname):


                                    full_name=fname+" "+lname
                                    return full_name

                              your_name=Name("Sonia",'Mittal')

                              print(your_name)

                        2.  Find errors in the codes given below and correct them.

                            a.  print('I am Akshay Kumar")







                                                                                   Functions and String  in Python  139
   136   137   138   139   140   141   142   143   144   145   146