How would you create a str.format() placeholder in the format string to ensure at least 20 characters minimum width for the first value?
Select one:
a.
[20:0]
b.
{:20.0}
c.
{0:20}
d.
0{20}
5 answers
c. {0:20}
Which of the following placeholder expressions in a str.format() format string will limit (truncate) the width of an output value to 10 characters?
Select one:
a.
[:10]
b.
{:10}
c.
{10}
d.
{:5.10}
Select one:
a.
[:10]
b.
{:10}
c.
{10}
d.
{:5.10}
b. {:10}
What is the output from the following statement?
print(str.format("Sale Price: ${0:6,}",1500))
Select one:
a.
Sale Price: $ ValueError
b.
Sale Price: $ 1,500
c.
Sale Price: $ 0
d.
Sale Price: $ 1500
print(str.format("Sale Price: ${0:6,}",1500))
Select one:
a.
Sale Price: $ ValueError
b.
Sale Price: $ 1,500
c.
Sale Price: $ 0
d.
Sale Price: $ 1500
b. Sale Price: $ 1,500