In this assignment write the following in Python. Assume a= “Hello world” b=\'Th
ID: 3802347 • Letter: I
Question
In this assignment write the following in Python.
Assume
a= “Hello world”
b='This is my first program'
math_string=”2+4*5”
expression_string=”a+ ' ' + b +' Tiger'”
then answer the following
Explanation / Answer
print(math_string.find('+'))
print(math_string.find('5'))
print(b.replace('i', 'o'))
print(b)
b = b.replace('i', 'o')
print(b)
Hello worldThis is my first programprint(len(a)) 11 print(len(b+a)) 35 c=a+b
d=b+a
print(c)
print(d)
print(c+d)
Hello worldThis is my first program This is my first programHello world Hello worldThis is my first programThis is my first programHello worldprint(a.split(' '))
['Hello', 'world']print(b.split(' '))
['This', 'is', 'my', 'first', 'program']
print(math_string.find('+'))
print(math_string.find('5'))
4
print(b.replace('i', 'o'))
print(b)
b = b.replace('i', 'o')
print(b)
Thos os my forst program This is my first program Thos os my forst programprint(eval(math_string))
print(eval(math_string+'2')) 22
210 print(expression_string)
print(eval(expression_string))
a+ ' ' + b +' Tiger' Hello world This is my first program Tiger