Page 127 - Trackpad_V1_Book 8_Flipbook
P. 127

You will get the following output:


















                 STRING OPERATORS

                 There are two basic string operators in Python, + and *. Python uses + for concatenation and * for
                 replication:

                     String Concatenation Operator (+): The string concatenation operator joins two or more
                     strings into one.

                 Program 8: To join two or more strings using the string concatenation operator













                 You will get the following output:

















                     String Replication Operator (*): The replication operator is used to repeat the string a given
                     number of times.

                 Program 9: To repeat a string using the string replication operator















                                                                                   Functions, String and List in Python  125
   122   123   124   125   126   127   128   129   130   131   132