TNSDC - EDUCAMPUS DATA ANALYST TRAINING - Python Assignments
TNSDC - EDUCAMPUS DATA ANALYST TRAINING - Python Assignments
Question 1: A store sells apples at $5 each and bananas at $3 each. Declare variables apples_price and
bananas_price with appropriate values. Calculate the total cost for purchasing 10 apples and 7 bananas
and store the result in total_cost.
Question 2: You have a monthly salary of $4,000 and expenses that include rent ($1,200), groceries
($300), and miscellaneous ($500). Calculate the amount left after expenses and store it in a variable
named remaining_balance.
Question 3: A team won 28 matches this season, and last season they won 18 matches. Declare
variables current_season_wins and last_season_wins with respective values. Calculate the increase in
matches won and store it in win_difference.
Question 4: A travel company charges $250 per person for a weekend trip and gives a $100 group
discount for every 5 people. If a group has 15 people Calculate the total cost for the group and store it in
group_trip_cost.
Question 5: An item costs $120, and there is a discount of 15%. Calculate the final price after the
discount and store it in discounted_price.
Question 6: A company produces 500 units daily and sells each unit for $20. Declare variables
units_per_day and price_per_unit. Calculate the monthly revenue assuming a 30-day month and store it
in monthly_revenue.
Question 7: A farmer grows wheat on a 150-acre farm and yields 3,000 kg per acre. Declare variables
acreage and yield_per_acre. Calculate the total wheat production and store it in total_production.
Question 8: A bakery makes $2 profit on each loaf of bread sold. If they sell 200 loaves in a day, declare
variables profit_per_loaf and loaves_sold. Calculate the daily profit and store it in daily_profit.
Question 9: You are planning an event for 120 attendees. The venue rental is $800, and catering costs
$25 per person. Declare variables venue_cost, catering_cost_per_person, and number_of_attendees.
Calculate the total cost of the event and store it in event_total_cost.
Question 10: A school's annual fee per student is $1,500, and they provide a 5% sibling discount. Declare
variables annual_fee and sibling_discount_percent. Calculate the discounted fee for one sibling and
store it in sibling_discounted_fee.
Assignment using Conditional Statements Q1:
Task: Write a program that asks for the customer's age and prints the ticket price.
Q2:
Task: Create a program that takes the current temperature (in Celsius) and provides an appropriate
advisory.
Q3:
Task: Write a program that asks for the bill amount and service quality (Excellent, Good, Fair, Poor) an
calculates the suggested tip.
Poor: 5% tip
Q5:
Task: Write a program that determines if a person is eligible to donate blood based on:
Q6:
Scenario: A car insurance company determines premiums based on driver's age and car type.
Q7:
Task: Write a program that predicts admission chances based on exam score:
Q9:
Task: Write a program that suggests a plan based on monthly data usage:
Q10:
Task: Create a program that calculates BMI (weight in kg / (height in m)^2) and provides a health risk
assessment:
25-29.9: "Overweight"
If the amount is greater than or equal to 5000, the customer gets a 20% discount.
If the amount is between 2000 and 4999, the customer gets a 10% discount.
If the amount is between 1000 and 1999, the customer gets a 5% discount.
Task: Write a program that takes the purchase amount as input and prints the applicable discount
percentage.
Task: Take a color input from the user and print the appropriate message.
If a person’s credit score is above 750 and their annual income is greater than 500,000, they are
eligible for a loan.
If their credit score is between 600 and 750 and income is between 300,000 and 500,000, they need a
guarantor.
If their credit score is less than 600, they are not eligible for a loan.
Task: Write a program that takes credit score and annual income as input and prints the eligibility
status.
Task: Write a program that takes the age as input and prints the ticket price.
Task: Write a program that takes the score as input and prints the grade.
Task: Write a program that takes the temperature as input and prints the classification.
If they have been a member for more than 5 years, print "Eligible for VIP access".
Task: Write a program that takes membership type and years as input and prints the benefits.
If the customer’s age is less than 18, they cannot rent a car.
If the customer’s age is between 18 and 25, they can rent but must pay an additional surcharge.
If the customer’s age is above 25, they can rent with no surcharge.
Task: Write a program that takes the customer's age as input and prints the rental conditions.
An online store provides free delivery only when certain conditions are met:
If the order amount is between $50 and $100 and the customer is a member, print "Free delivery".
Task: Write a program that takes the total order amount and membership status as input and prints
the delivery eligibility.
Problem 11: University Admission Criteria
Scenario: A university has different admission criteria based on the student's grades and
extracurricular activities:
• If they have participated in extracurricular activities, print "Admitted with standard fee".
• If the student has a grade lower than 'B', print "Application not considered".
Task: Write a program that takes the student’s grade and participation status as input and prints the
admission decision.
Scenario: A restaurant offers different discounts based on customer loyalty and the total bill amount:
• If the bill is between $50 and $100, print "10% discount applied".
• If the bill is between $50 and $100, print "5% discount applied".
Task: Write a program that takes loyalty status and bill amount as input and prints the discount.
• If their monthly income is greater than $3,000, print "Eligible for payment plan with 0%
interest".
• If their monthly income is between $2,000 and $3,000, print "Eligible for payment plan with
5% interest".
Task: Write a program that takes the customer's credit score and income as input and prints their
eligibility.
Scenario: A parking lot charges different fees based on the type of vehicle and the duration of parking:
• For other vehicle types, print "Contact parking office for fees".
Task: Write a program that takes the type of vehicle and parking duration as input and prints the
parking fee.
Problem 15: Weather Alert System
Scenario: A weather alert system needs to send notifications based on temperature and weather
conditions:
• If it’s sunny, print "Heatwave alert: Stay hydrated and avoid outdoor activities".
Task: Write a program that takes temperature and weather condition as input and prints the
appropriate alert.
Scenario: An online learning platform needs to grade students based on their exam scores and
attendance:
Task: Write a program that takes exam score and attendance as input and prints the grade.
Problem 17: Internet Speed Recommendations
Scenario: A tech support company provides recommendations based on internet speed and user type:
• If the user is a gamer, print "Optimal speed for gaming and streaming".
• If the user is not a gamer, print "Excellent speed for general usage".
• If the user is working from home, print "Consider upgrading for better performance".
• If the user is not working from home, print "Basic speed for minimal use".
Task: Write a program that takes internet speed and user type as input and prints the
recommendation.
• Create a tuple to store a user’s profile information: (username, age, city). Then, retrieve and
print each element in the tuple.
• Example: For a tuple user_profile = ("Alex", 30, "Mumbai"), print each element separately.
• You are building a simple task manager. Create a list called tasks that stores tasks as strings.
Add three tasks to the list and then remove one. Finally, display the remaining tasks.
• Example: Add "Email client", "Review report", "Complete project" to tasks, remove "Review
report," and display the list.
• Use a dictionary to store grocery items and their prices (e.g., {"Apples": 100, "Milk": 50,
"Bread": 30}). Ask the user to input an item name, and then return the price of that item.
• Create a set called students that stores names of students who have submitted their
assignments. Add a few names to the set, including duplicates, and print the final list of
unique students.
• Example: Add "John", "Alice", "Bob", "Alice" to the set and display {"John", "Alice", "Bob"}.
• Store the names of students and their grades using a dictionary (e.g., {"Alice": [88, 92, 79],
"Bob": [78, 85, 88]}). Calculate and print the average grade for each student.
• Example: For {"Alice": [88, 92, 79], "Bob": [78, 85, 88]}, output: Alice: 86.33, Bob: 83.67.
• In a survey, some email addresses were collected multiple times. Use a set to remove
duplicate email addresses and display a unique list of all emails.
• Create a dictionary representing a library’s book collection, where keys are book titles and
values are the number of copies available. Prompt the user to borrow a book, decrease the
count by 1 if available, and display the updated collection.
• Example: For {"Harry Potter": 3, "Python Basics": 2}, if a user borrows "Harry Potter", update
to {"Harry Potter": 2, "Python Basics": 2}.
• You are building a shopping cart. Create a list of items in the cart and a corresponding list of
prices. Calculate the total cost of all items in the cart and display it.
• Example: For items ["Shoes", "Hat", "Shirt"] and prices [500, 150, 300], display Total: 950.
• Create a dictionary where each employee ID maps to a tuple containing employee details like
(name, age, position). Then, allow the user to input an ID to retrieve and display the details of
that employee.
• Example: For {"101": ("Alice", 30, "Manager"), "102": ("Bob", 25, "Engineer")}, if the user
inputs "101", display ("Alice", 30, "Manager").
10. Set & Dictionary - Online Course Students (Medium)
• Suppose you are managing student enrollments for two different online courses. Use sets to
store the enrolled students' IDs for each course. Display the IDs of students who are enrolled
in both courses (intersection of sets).
• Example: For course_A = {1, 2, 3, 4} and course_B = {3, 4, 5, 6}, display Students in both
courses: Students in both courses: {3, 4}