Important Notice:

Course Content
Strings in Python (Chapter-6) M3-R5
About Lesson

String Operators:-

          String में 4 operator कार्य करते हैं-

1. Concatenation (+) Operator

2. Repetition (*) operator

3. Membership (in & not in) operator

4. Comparison (>,<, ==, !=) operator

Concatenation (+) Operator:-

          इस operator का use दो string को जोड़ने के लिए किया जाता है

st1= “ram”   st2= “sita”             print(st1+st2)        #ramsita

Note:- यह ऑपरेटर एक ही प्रकार के operand को जोड़ने के लिए use किया जाता है

Repetition (*) operator:-

          इस operator का use string को multiply करने के लिए किया जाता है

a= “ram”     print(a*2)              # ramram

a=”ram”      print(a*’2′)            #error

 

String Operators:-

          4 operators work in String-

1. Concatenation (+) Operator

2. Repetition (*) operator

3. Membership (in & not in) operator

4. Comparison (>,<, ==, !=) operator

Concatenation (+) Operator:-

          This operator is used to join two strings.

st1= “ram”   st2= “sita”             print(st1+st2)        #ramsita

Note:- This operator is used to combine operands of the same type.

Repetition (*) operator:-

          This operator is used to multiply the string.

a= “ram”     print(a*2)              # ramram

a=”ram”      print(a*’2′)            #error

error: Content is protected !!