Strings are sequences of case-sensitive characters, used to hold text-like data. Strings have many operations defined on them:
<str> + <str>
s1 = "hello"
s2 = "world"
s3 = s1 + s2 # s3 = "helloworld"
s4 = s1 + " " + s2 # s4 = "hello world"
<str> * <int>
s1 = "hello"
s2 = s1 * 4 # s2 = "hellohellohellohello"
We used the same operator on different object types, and those operators performed different functions. Operator overloading is when operations have different functions depending on the object types provided to them.
Other string operations:
len
s1 in s2
True
s1
s2
False
==
<
>
input()
for
range
while
break
continue