-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex8.py
More file actions
18 lines (17 loc) · 709 Bytes
/
ex8.py
File metadata and controls
18 lines (17 loc) · 709 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# This is function called "formatter". It is assigned four {} which will turn
# the formatter variable into four strings.
formatter = "{} {} {} {}"
# Take the formatter string defined on line 3 and call its format function.
# Pass the four arguments, 1, 2, 3, 4 to it.
# The result of calling format on formatter is a new string that has
# the {} replaced with the four variables. Print will print these out.
print(formatter.format(1, 2, 3, 4))
print(formatter.format("one", "two", "three", "four"))
print(formatter.format(True, False, False, True))
print(formatter.format(formatter, formatter, formatter, formatter))
print(formatter.format(
"I am",
"not afraid,",
"Toad said",
"to Frog."
))