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 : 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 "Shorthaul" less than hours "Mediumhaul" to hours and "Longhaul"
more than 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 calculatemean that takes a list of durations and returns the average mean
duration.
Define a function calculatemedian that takes a list of durations and returns the median duration.
Define a function calculatemode that takes a list of durations and returns the mode duration.
Define a function findlongestflight that takes a list of flight numbers and their corresponding
durations, and returns the flight number with the longest duration.
Define a function categorizeflights that takes a list of flight numbers and their corresponding
durations, and returns a dictionary categorizing flights into "Shorthaul", "Mediumhaul", 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:
Enter flight number: CX
Enter duration for flight CXin minutes:
Enter flight number: CX
Enter duration for flight CXin minutes :
Enter flight number: CX
Enter duration for flight CXin minutes :
Enter flight number: CX
Enter duration for flight CXin minutes :
Enter flight number: CX
Enter duration for flight CXin minutes:
Mean duration: minutes
Median duration: minutes
Mode duration: minutes
Longest flight: CX
Categorized flights:
Shorthaul: CXCX
Mediumhaul: CXCX
Longhaul: CX
Question : 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 businessrelated 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
Use a while l
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
