Question: Solve step by step and please don't use AI to answer, i will check it from AI detector. Thanks Question 1 : Analyzing Flight Data

Solve step by step and please don't use AI to answer, i will check it from AI detector. Thanks
Question 1: Analyzing Flight Data for an Aviation Company
Objective: The objective of this assignment is to introduce students to intermediate Python programming
concepts such as strings, functions, and lists. By the end of this assignment, students will be able to manipulate
strings, create and use functions, and work with lists to solve a more complex problem related to analyzing
flight data for an aviation company.
Scenario: You are a data analyst for an aviation company. The company operates multiple flights, and you need
to analyze the flight data to provide insights. The program should be able to calculate the average (mean),
median, and mode of flight durations, identify the flight with the longest duration, and categorize flights based
on their duration. Note that if the number of data points is even, median will be the average of the middle two
values. If there are more than one data values with the same highest frequency, all will belong to the mode.
Problem Statement: Write a Python program that:
Takes user input for a list of flight numbers and their corresponding durations (in minutes).
Calculates the average (mean) flight duration.
Calculates the median flight duration.
Calculates the mode of the flight durations.
Identifies the flight with the longest duration.
Categorizes flights into "Short-haul" (less than 3 hours), "Medium-haul" (3 to 6 hours), and "Long-haul"
(more than 6 hours).
Prints the results in a formatted string.
Assumptions:
The user will provide the list of flight numbers and their corresponding durations.
Each flight has only one duration associated with it.
The list will contain at least one flight.
Instructions:
Define a function calculate_mean() that takes a list of durations and returns the average (mean)
duration.
Define a function calculate_median() that takes a list of durations and returns the median duration.
Define a function calculate_mode () that takes a list of durations and returns the mode duration.
Define a function find_longest_flight () that takes a list of flight numbers and their corresponding
durations, and returns the flight number with the longest duration.
Define a function categorize_flights () that takes a list of flight numbers and their corresponding
durations, and returns a dictionary categorizing flights into "Short-haul", "Medium-haul", and "Long-
haul".
Use user input to create the list of flight numbers and durations.
Call the defined functions to calculate the mean, median, mode, longest flight, and categorize flights,
and print the results.
Deliverables:
A Python script that includes the defined functions and the main program logic.
The script should prompt the user for input and print the average (mean) duration, median duration,
mode duration, the flight with the longest duration, and the categorized flights in a formatted string.
Sample Output:
Enter the number of flights: 5
Enter flight number: CX001
Enter duration for flight CX001(in minutes): 500
Enter flight number: CX002
Enter duration for flight CX002(in minutes) : 150
Enter flight number: CX003
Enter duration for flight CX003(in minutes) : 300
Enter flight number: CX004
Enter duration for flight CX004(in minutes) : 350
Enter flight number: CX005
Enter duration for flight CX005(in minutes): 60
Mean duration: 272.00 minutes
Median duration: 300.00 minutes
Mode duration: \([500.0,150.0,300.0,350.0,60.0]\) minutes
Longest flight: CX001
Categorized flights:
Short-haul: ['CX002','CX005']
Medium-haul: ['CX003','CX004']
Long-haul: ['CX001']
-----------------------------------------------------------------------------------
Question 3: Simulating Popularity Assessment and Revenue Calculation for Queen Elizabeth Hospital
Objective: The objective of this assignment is to simulate the popularity assessment and revenue calculation for
various departments within Queen Elizabeth Hospital in Hong Kong using functions, strings and lists and basic
control structures. This exercise will help you understand the application of these programming constructs in
solving complex business-related problems.
Scenario: Imagine Queen Elizabeth Hospital in Hong Kong needs to calculate the monthly revenue for its
various departments based on the popularity assessment of each department. Each department has a popularity
score that affects its revenue. The popularity score is determined by factors such as quality of care, facilities,
and patient reviews. The goal is to simulate the calculation of the monthly revenue for a set of departments over
a given period.
Problem Statement: You are required to write a program that simulates the popularity assessment and revenue
calculation for various departments within Queen Elizabeth Hospital. The program should:
Define a function that calculates the popularity score based on the given factors.
Define a function that updates
5. Use a while l
Solve step by step and please don't use AI to

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 Programming Questions!