Page 151 - Plus_V2.2_C8_Flipbook
P. 151

String Operators

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

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

                  Program 5: To join two or more strings using string concatenation operator.












                 You will get the following output:
















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
















                 You will get the following output:



















                                                                                      Functions and String in Python  149
   146   147   148   149   150   151   152   153   154   155   156