PY1 Write a program that asks the user to input the cost of their meal as a deci
PY1 Write a program that asks the user to input the cost of their meal as a decimal amount and the tip as a percent as a whole number. Use a standard tip percent of your choice. The program should use a tax rate of 7 percent that is stored in a properly named constant as decimal. The program should then calculate the dollar amounts of the tip and tax and add these to the original cost to calculate the grand total. The program should then display these amounts (the tax, the tip, and the grand total) to the user. Review the Python math operators on page 54 to help with this task and use f_string printing. The program’s prompts and output should be formatted as in the Example Input/Output below. Example for PY1 What is the total cost of the meal? 20 What is the tip percentage? 20 A $20.00 meal with a 20% tip of $4.00 and 7% tax has a grand total cost of $25.40 PY2 Write a Python program named program2_2.py. The program should prompt the user to input a number of hours as an integer. The program should then convert this number into the equivalent number of days and hours. These converted values should be reported as integers. The program should output this conversion in the format “X hours is equivalent to Y days and Z hours”, where X is the original number of hours, Y is the number of days, and Z is the remaining number of hours. Review the Python math operators on page 54 to help with this task and use f_string printing. The program’s prompts and output should be formatted as in the Example Input/Output below. Example PY2 What is the number of hours to convert to days and hours? 26 26 hours is equivalent to 1 days and 2 hours
Leave a Reply