Professional Documents
Culture Documents
Strings: - Python Supports Concatenating Strings Using The Addition Operator
Strings: - Python Supports Concatenating Strings Using The Addition Operator
h = "hello“
w = "world“
hw = h + " " + w
print(hw)
Strings
• Python also supports multiplying strings to form a string with a
repeating sequence.
h1 = "hello" * 10
print(h1)
Lists
• Lists can be joined with the addition operators.
even_numbers = [2,4,6,8,10]
odd_numbers = [1,3,5,7,9]
all_numbers = odd_numbers + even_numbers
print(all_numbers)
Lists
• Just as in strings, Python supports forming new lists with a repeating
sequence using the multiplication operator.
ls = [1,2,3] * 3
print(ls)