Question: Using this code please help do the TODO TAX _ RATE = 0 . 0 7 def main ( ) : title = 'From Here

Using this code please help do the TODO
TAX_RATE =0.07
def main():
title = 'From Here to Python'
price =4.50
count =7
# TODO: Convert these 4 output statements so they are using f-strings
# instead of the string format method
print('We have {0} copies of the book.'.format(count))
# Comment the above line and put your conversion on the next line
print('The {0} copies cost {1:.2f} each.'.format(count, price))
# Comment the above line and put your conversion on the next line
print('Title: {2}
Count: {0}
Price: {1:.2f}'.format(count, price, title))
# Comment the above line and put your conversion on the next line
print('The tax on {0:.2f} is {1:.2f}.'.format(price, price * TAX_RATE))
# Comment the above line and put your conversion on the next line
print()
# TODO: Convert these 4 output statements so they are using the string
# format method instead of f-strings
print(f'The title of the book is {title}.')
# Comment the above line and put your conversion on the next line
print(f'"{title}" costs {price:.2f}')
# Comment the above line and put your conversion on the next line
print(f'We have {count} copies of "{title}" in stock.')
# Comment the above line and put your conversion on the next line
print(f'To buy all {count} copies of "{title}" will cost {count * price:.2f}')
# Comment the above line and put your conversion on the next line
main()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!