8000 printing done · cmdncode/Intro-Python-I@85642ed · GitHub
[go: up one dir, main page]

Skip to content

Commit 85642ed

Browse files
committed
printing done
1 parent 4e916e1 commit 85642ed

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

src/printing.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,30 @@
1212
# y, and z:
1313
# x is 10, y is 2.25, z is "I like turtles!"
1414

15+
print('x is %s!' % x)
16+
print('y is %s!' % y)
17+
print('z is %s' % z)
18+
1519
# Use the 'format' string method to print the same thing
1620

17-
# Finally, print the same thing using an f-string
21+
str = "x is {}"
22+
print (str.format(x))
23+
24+
str = "y is {}"
25+
print (str.format(y))
26+
27+
str = "z is {}"
28+
print (str.format(z))
29+
30+
# Finally, print the same thing using an f-string
31+
32+
# name = "Eric"
33+
# >>> age = 74
34+
# >>> f"Hello, {name}. You are {age}."
35+
# 'Hello, Eric. You are 74.'
36+
37+
print (f'x is {x}')
38+
39+
print (f'y is {y}')
40+
41+
print (f'z is {z}')

0 commit comments

Comments
 (0)
0