Question
While Loop: Two Lists become One Dictionary Create a program that uses a While loop to iterate through two provided lists below and combine them
While Loop: Two Lists become One Dictionary
Create a program that uses a While loop to iterate through two provided lists below and combine them into a Dictionary. The first List is a list of names which will be the Keys. The second List is a list of numbers which will be the Values. The data is stored properly to create ordered pairs already. So the first key/value pair in the dictionary should be {'David': 2} which are both at position zero in their respective lists, the second {'Michael':1} and so on. At the end you should print the newly created dictionary to the console to prove the process was a success.
While Loop: Poll the People Create a program that will ask for a user Input for a number 1 through 5. The program must be stored in a while loop that continues until someone inputs a string that causes the loop to exit. The amount of votes each number is given should be stored in a variable outside the loop. If the number provided is not a listed number print an error message that informs the user to chose a valid option.
Function: Repair or Not
You have been hired by a company to create a function that will take three values: days needed for repair, cost per day, and estimated losses. Using these three parameters your function should calculate the total cost (days needed for repair multiplied by cost per day) and then compare it against potential losses (estimated losses multiplied by 1.25). If the total cost is greater than the potential losses your Function should print "Do Not Fix", otherwise it will print "Fix the issue". Provided are some test variables that when used in your function should return "Do Not Fix" and "Fix the Issue" respectively.
Provided Code: #Variables for function to return "Do Not Fix"(Comment after variable is for clarity) days_needed_light_fail = 5 #Five cost_per_day_light_fail = 2500 #Twenty-Five Thousand est_losses_light_fail = 3000 #Three Thousand
#Variables for function to return "Fix the Issue"(Comment after variable is for clarity) days_needed_oven_fail = 1 #One cost_per_day_oven_fail = 15000 #Fifteen-Thousand est_losses_oven_fail = 30000 #Thirty-Thousand
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