Question

In: Computer Science

Weight Lifting Make a dictionary where the keys are the names of weight lifting exercises, and...

Weight Lifting Make a dictionary where the keys are the names of weight lifting exercises, and the values are the number of times you did that exercise.(At least 5 exercises,be creative. Nobody should have same values)

Use a for loop to print out a series of statements such as "I did 10 bench presses". Modify one of the values in your dictionary, to represent doing more of that exercise. Use a for loop to print out a series of statements such as "I did 10 bench presses". Add a new key-value pair to your dictionary. Use a for loop to print out a series of statements such as "I did 10 bench presses". Remove one of the key-value pairs from your dictionary. Use a for loop to print out a series of statements such as "I did 10 bench presses". Use a function to do all of the looping and printing in this problem.

Solutions

Expert Solution

The code for the required program is given below.

main.py

WeightLifting =
{"Biceps Curl": 10,
"Bench Press": 5,
"Triceps Extension":15,
"Lateral Raise":7,
"The Chest Fly":20}

def printData():
print(" ")
for i in WeightLifting:
print("I did" , WeightLifting[i] , i)
print(" ")
  
#driver code
def main():
printData()
#updating values
WeightLifting["Bench Press"] = 25
#printing data
print("After Modiying value ")
printData()
#adding new data
WeightLifting["Rear Delt Row"] = 12
print("After Adding Key Pair value ")
printData()
#removing key pair value Bench Press
del WeightLifting["Bench Press"]
print("After Deleting value ")
printData()
  
main()


Screenshot of Output and code for indentation


Related Solutions

ising software pyton 3.5 Weight Lifting Make a dictionary where the keys are the names of...
ising software pyton 3.5 Weight Lifting Make a dictionary where the keys are the names of weight lifting exercises, and the values are the number of times you did that exercise.(At least 5 exercises,be creative. Nobody should have same values) Use a for loop to print out a series of statements such as "I did 10 bench presses". Modify one of the values in your dictionary, to represent doing more of that exercise. Use a for loop to print out...
*Python* 1.1) Create an empty dictionary called 'addresses'. The dictionary you just created will map names...
*Python* 1.1) Create an empty dictionary called 'addresses'. The dictionary you just created will map names to addresses. A person's name (stored as a string) will be the KEY and that person's address (stored as a string) will be the VALUE. 1.2) Insert into the dictionary 'addresses' the names and addresses of two (possibly imaginary) friends of yours. 1.3) Create a second empty dictionary called 'ages'. The dictionary you just created will map names to ages. A person's name (stored...
python Create a dictionary and insert several English words as keys and the Pig Latin (or...
python Create a dictionary and insert several English words as keys and the Pig Latin (or any other language) translations as values. Write a function called bonus that takes as a parameter a dictionary that has names as keys and salaries as values. Your function should increase everyone’s salary in the dictionary by 5%. Write a function called updateAge that takes as parameters a list of names of people whose birthday it is today, and a dictionary that has names...
The groups_per_user function receives a dictionary, which contains group names with the list of users.
The groups_per_user function receives a dictionary, which contains group names with the list of users. Users can belong to multiple groups. Fill in the blanks to return a dictionary with the users as keys and a list of their groups as values.def groups_per_user(group_dictionary):   user_groups = {}   # Go through group_dictionary   for ___:       # Now go through the users in the group       for ___:           # Now add the group to the the list of# groups for this...
Problem 1: For all of the following problems, imagine a crane that is lifting a weight...
Problem 1: For all of the following problems, imagine a crane that is lifting a weight of mass m through a height h at constant speed, and consider the following three choices of system: (1) system is the weight only; (2) system is the weight and the earth; (3) system is the crane only. For each of these choices, and in this order, what is the net work done on the system by the external forces (Wext,sys) in the process...
A weight-lifting coach wanted to know whether weight-lifters can change their strength by taking a certain...
A weight-lifting coach wanted to know whether weight-lifters can change their strength by taking a certain supplement. To answer this question, the coach randomly selected 8 athletes and gave them a strength test using a bench press. Thirty days later, after regular training using the supplement, they were tested again. The results were listed below. A test was conducted to determine whether weight-lifters can change their strength by taking a certain supplement. Assume the populations are normally distributed. Athlete 1...
Write a python program that keeps names and email addresses in a dictionary as key-value pairs....
Write a python program that keeps names and email addresses in a dictionary as key-value pairs. The program should display a menu that lets the user look up a person’s email address, add a new name and email address, change an existing email address, and delete an existing name and email address. The program should bind the dictionary and save it to a file when the user exits the program. Each time the program starts, it should retrieve the dictionary...
1.Suppose a dictionary Groceries maps items to quantities.     Write a python to print the names...
1.Suppose a dictionary Groceries maps items to quantities.     Write a python to print the names of the grocery items whose quantity exceeds 400.     For example, if groceries = {‘cake mixes’: 430, ‘cheese’:312, ‘Orange’:525, ‘candy bars’: 217}         The output will be                                 Cake mixes                                 Orange 2. which Python string method would be the best choice to print the number of time “the” occurs in a sentence entered by the user? Provide a one word answer. Just...
During high-intensity exercise such as sprinting or lifting a very heavy weight, energy is provided to...
During high-intensity exercise such as sprinting or lifting a very heavy weight, energy is provided to cells by the phosphogen system (or ATP-PC system), which only works for a few seconds. If the diffusion constant of ATP is 3 ×10−10 m2 s-1, how far could this molecule diffuse in 5 seconds? (not 5.477E-5 m)
10. A manufacturer produces 25-pound lifting weights. The lowest actual weight is 24 pounds, and the...
10. A manufacturer produces 25-pound lifting weights. The lowest actual weight is 24 pounds, and the highest is 26 pounds. Each weight is equally likely so the distribution of weights is uniform. A sample of 100 weights is taken. a. Find the probability that the mean actual weight for the 100 weights is greater than 24.8. (Round your answer to four decimal places. b. Find the 95th percentile for the mean weight for the 100 weights. (Round your answer to...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT