When we try to print something, the + sign with strings doesn’t mean addition, however it means concatenation, joining texts together. The , sign also means concatenation. Comma-separated prints add spaces.
Example A:
first = "Hello"
second = "World"
print(first + " " + second)
print(first,second)
Output example A:
Hello World
Hello World
The * symbol means repetition in strings, like laughing ha three times.
Example B:
laugh = "ha"
print(laugh * 3)
Output example B:
hahaha
Methods are little tools for strings, letting us change how text looks.
Example C:
text = "python"
print(text.upper())
Output example C:
PYTHON
Example D:
text = "python"
print(text.lower())
Output example D:
python