Python Test
Question 1 :
Movie Name
Tickets Sold
Price Per Ticket
Calculate:
Total earnings for each movie
Movie with the highest earnings
movies = [
["Avengers", 500, 10],
["Inception", 300, 12],
["Titanic", 400, 8]
]
Output:- Total Earnings: [['Avengers', 5000], ['Inception', 3600], ['Titanic', 3200]]
Highest Earning Movie: ['Avengers', 5000]
Question 2:-
Name
Department
Salary
Write a program to:
Filter employees by department
Find the total salary expense for the IT department
Sort employees by salary in descending order
employees = [
["Alice", "HR", 50000],
["Bob", "IT", 75000],
["Charlie", "Sales", 60000],
["David", "IT", 80000],
["Eve", "Finance", 70000]
Output:- IT Department Employees: [['Bob', 'IT', 75000], ['David', 'IT', 80000]]
Total IT Salary: 155000
Employees Sorted by Salary: [['David', 'IT', 80000], ['Bob', 'IT', 75000],
['Eve', 'Finance', 70000], ['Charlie', 'Sales', 60000], ['Alice', 'HR', 50000]]
Question 3:- [1,2,3,True,(1,'s'),4,[1,2,1,3]]*2
Count 1 occurrence