-
Notifications
You must be signed in to change notification settings - Fork 0
/
ex6.py
35 lines (26 loc) · 788 Bytes
/
ex6.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# Assign values to initial variables
x = "There are %d types of people." % 10 # Is 10 treated as a string here?
binary = "binary"
do_not = "don't"
# First interpolation of simple strings into a slightly less simple string
y = "Those who know %s and those who %s." % (binary, do_not)
# First printout of variable values
print x
print y
# Add some air
print
# Printout repeats of previous
print "I said: %r." % x
print "I also said: '%s'." % y
# Add some air
print
# Printout meta-commentary, illustrate deferred interpolation
hilarious = False
joke_evaluation = "Isn't that joke so funny?! %r"
print joke_evaluation % hilarious
# Add some air
print
# Illustration of simple string concatenation
w = "This is the left side of . . . "
e = "a string with a right side."
print w + e