Question: Task 0 3 ( 2 0 points ) Task 0 4 ( 2 0 points ) Write a Python program that completes the following steps:

Task 03(20 points) Task 04(20 points)
Write a Python program that completes the following steps:
Create a list named fruits containing the following elements: "Apple", "Banana", "Cherry",
"Date", "Elderberry".
Print the list.
Convert the fruits list to a tuple named fruits_tuple.
Print the tuple.
Convert the fruits list to a set named fruits_set.
Print the set.
Convert the fruits list to a dictionary named fruits_dict that contains the fruits as keys and
their lengths as values:
a. Lengths being the size of the word (key)- Apple is 5, Banana is 6, but these
should not be hardcoded values, you need to use the len() function to gather the
length of the key.
Print the dictionary.
Add "Fig" and "Grape" to the fruits list.
Remove "Date" from the fruits list.
Print the updated list.
Update fruits_dict to reflect the changes made to the fruits list.
Print the updated dictionary.
Here is a screenshot of the expected behavior. Replicate this functionality in your script,
including the formatting and outputs of all messages. Task 05(40 points)
Write a Python program that contains multiple user-defined functions that calculate storage
requirements and costs. These functions will provide useful metrics in the context of data
storage and backup solutions. Perform the following steps:
Create a function named calculate_backup_size that takes two arguments: data_size (in
gigabytes) and backup_frequency. This function should return the data_size multiplied
by backup_frequency, representing the total storage needed for backups in a week.
Create another function named calculate_storage_cost that takes two arguments:
backup_size and cost_per_gb. This function should return the value of backup_size
multiplied by cost_per_gb, representing the total cost for the backup storage.
Create a third function named storage_info that takes four arguments: data_size,
backup_frequency, cost_per_gb, and weeks. This function should call
calculate_backup_size and calculate_storage_cost functions, taking the appropriate
arguments. Then it should multiply the cost by the number of weeks. It should return a
string that says "The total storage needed for backup is x GB and the total cost for Y
weeks is Z dollars", replacing x,Y, and Z with the calculated values.
Prompt the user to enter values for data_size, backup_frequency, cost_per_gb, and
weeks. If the user does not enter a positive number, your program should catch this error
and ask for the input again.
Call the storage_info function with the user-provided data_size, backup_frequency,
cost_per_gb, and weeks and print the returned string.
Provide comments in your code to explain the logic used.
Test your program with different inputs and ensure it performs the calculations correctly.
When your program runs, it should match the expected output. Go back in and put in labels as
needed. The program should work for any valid inputs that the user provides.
Write a Python program that manages the student records of a class in your school.
Lists: Create a list of student names. These are strings representing the names of
students in your class (e.g.,["John", "Mary", "Peter", "Sam"]).
Tuples: For each student, create a tuple that stores their grades in different subjects.
The subjects are Mathematics, English, and Science (e.g.,(85,90,88)).
Dictionaries: Now, create a dictionary where the keys are the names of the students
(from your list), and the values are the tuples storing their grades. This way, you can
easily look up a student's grades in different subjects.
Your final program should be able to print the names of all students, their grades in different
subjects, and their average grade. Make sure to use loops and appropriate Python built-in
functions in your program.
Here is a screenshot of the expected behavior. Replicate this functionality in your script,
including the formatting and outputs of all messages.
eric@iftlinux: / Lab_g$ ./lab_g_task_03_sdevil.py
Student Name: John
Mathematics Grade: 85
English Grade: 90
Science Grade: 88
Average Grade: 87.66666666666667
Student Name: Mary
 Task 03(20 points) Task 04(20 points) Write a Python program that

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!