Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Assignment: Three variables, price, tax and discount, supposedly hold strings of digits, suitable for converting to floats. Write code that converts them and displays the
Assignment: Three variables, price, tax and discount, supposedly hold strings of digits, suitable for converting to floats. Write code that converts them and displays the total cost price tax discount rounded to the second decimal digit. However, if any variable fails to convert, display a string "Failed to convert values: followed by the names of the variables that failed, separated by space. The variables should be sorted as price, tax and discount.
If in order the variables were Hi: the output would be Failed to convert values: price discount.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started