一:代码
x = "There are %d types of people." % 10
binary = "binary"
do_not = "don't"
y = "Those who know %s and those who %s" % (binary, do_not)
print x
print y
print "I said: %r." % x
print "I also said: '%s'." % y
hilarious = False
joke_evaluation = "Isn't that joke so funny?! %r"
print joke_evaluation % hilarious
w = "This is the left side of..."
e = "a string with a right side."
print w + e
二:附加练习
1:在每一行上写一行注释
2:找到所有“把一个字符串放进另一个字符串”的位置。共有四处。
3:确定只有四处?
。。。
4:解释一下为什么w和e用+连起来就可以生成一个更长的字符串。
答:字符串相加就是简单的将两个字符串连接到一起合成一个字符串。