Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Q2 (3 pt) Write a Python program that computes a percentage score, prompting the user for the total points earned and the total possible points.
Q2 (3 pt) Write a Python program that computes a percentage score, prompting the user for the total points earned and the total possible points. Use the following steps: Prompt the user for the points earned and store it in a variable called points earned str. (Think: Why did I choose this variable name?) Prompt the user for the total possible point and store it in a variable called possible_points_str Convert points earned str to a floating point number and store it in a variable called points_earned. (Hint: Now do you see the naming pattern?) Convert possible_points str to a floating point number and store it in a variable called possible_points. Compute the percentage score using the formula: score 100.0 points_earned/possible points and assign the resulting score to a variable called score. Display the result. In [26]: # Enter your code for question 2 here Q3. (4 pts) Write a Python program to calculate tax and tip. Ask the user for a check amount, and calculate the tax and tip, providing tip amounts for stingy, regular, and generous customers. Use the following steps: Prompt the user for a check amount and store it in a variable called check amount str Convert check_amount str to a floating point number and store it in a variable called check amount. Calculate tax amount (6%) and three tip amounts (15%, 18%, and 20%), storing each result in a separate variable. Calculate total for regular customers including 6% tax and 15% tip. Print the results to the console like in the example below, including the base cost of the meal, tax, three tip levels, and total for regular customers. The expected output from your program should look like the following: Please enter check amount: $ 20 Base cost: 20.00 Tax (696): $ 1.20 Tip for traditional customers (15 %): $ 3.00 Tip for regular customers (18 %): $ 3.60 Tip for generous customers (20%): $ 4.00 Total with tax and tip for regular customers: 24.80
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