String_Operators_Practice
String_Operators_Practice
and Replication
1. Explanation
➤ Concatenation (+ operator): Used to join two or more strings.
Example:
str1 = "Hello"
str2 = "World"
result = str1 + " " + str2
Output: Hello World
Example:
text = "Hi! "
result = text * 3
Output: Hi! Hi! Hi!
8. Form a sentence:
Input: name = "Liam", hobby = "painting"
Answer: Hello Liam! I heard you like painting.
Bonus Challenge
9. Repeat name with dashes:
Input: Arya
Answer: Arya-Arya-Arya