In [1]:object1 = "data" + "analysis" + "visualization"
In [2]:object1
Out[2]:'dataanalysisvisualization'
In [3]:object2 = 1 * 3
In [4]:object2
Out[4]:3
In [5]:object3 = "1" * 3
In [6]:object3
Out[6]:'111'
第一个代码是字符串相加,相当于将字符串粘贴在一起;
第二个代码是纯数学运算,计算1*3=3;
第三个代码是将1用引号引起来作为字符串,表示将1显示三次;
2.turple进行解码
# Define shout_all with parameters word1 and word2
def shout_all(word1, word2):
# Concatenate word1 with '!!!': shout1
shout1=word1+"!!!"
# Concatenate word2 with '!!!': shout2
shout2=word2+"!!!"
# Construct a tuple with shout1 and shout2: shout_words
shout_words=(shout1,shout2)
# Return shout_words
return shout_words
# Pass 'congratulations' and 'you' to shout_all(): yell1, yell2
yell1,yell2=shout_all("congratulations","you")
# Print yell1 and yell2
print(yell1)
print(yell2)