Create a string variable named a with the value "The New York Times"
a = "The New York Times" # you can also use single quotes
Test if 'New' is part of the string
"New" in a
True
Concatenate "is an American newspaper based in New York City" to the variable a.
#option 1:
a + "is an American newspaper based in New York City"
'The New York Timesis an American newspaper based in New York City'
#option 2
"{} is an American newspaper based in New York City".format(a)
'The New York Times is an American newspaper based in New York City'
#option 3
f"{a} is an American newspaper based in New York City"
'The New York Times is an American newspaper based in New York City'
Create a list variable, named b, containing 4, a, True and 10.5 (Note: a is the string variable you created at step 1)
b = [4, a, True, 10.5]
Print out b
print(b)
[4, 'The New York Times', True, 10.5]
Test if a is inside this list variable
a in b
True
Print the type of the variable b
print(type(b))
<class 'list'>