forked from psounis/python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstring.operators.py
More file actions
13 lines (13 loc) · 551 Bytes
/
string.operators.py
File metadata and controls
13 lines (13 loc) · 551 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
string = "Hello "
concatenation = string + string
print(f"Concatenation(+): {concatenation}")
multiplication = string * 5
print(f"Multiplication(*): {multiplication}")
string += "World!" # string = string + "World!"
print(f"Increment: {string}")
print(f"Char in string: 'W' in {string}: {'W' in string}")
print(f"Char not in string: 'W' not in {string}: {'W' not in string}")
comparison = "abc" < "abd" # also: >, <=, >=
print(f"Comparison: {comparison}")
equality = "aa" == "AA".lower() # also not equal: !=
print(f"Equality: {equality}")