0% found this document useful (0 votes)
76 views13 pages

TNSDC - EDUCAMPUS DATA ANALYST TRAINING - Python Assignments

Notes

Uploaded by

pradeepraja430
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
76 views13 pages

TNSDC - EDUCAMPUS DATA ANALYST TRAINING - Python Assignments

Notes

Uploaded by

pradeepraja430
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

Assignments using Variables

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:

Q1 Movie Ticket Pricing

Scenario: A cinema has different ticket prices based on age.

Task: Write a program that asks for the customer's age and prints the ticket price.

Child (0-12): ₹100

Teen (13-17): ₹150

Adult (18-59): ₹200

Senior (60+): ₹120

Q2:

Simple Weather Advisory

Scenario: A local weather station provides basic weather advisories.

Task: Create a program that takes the current temperature (in Celsius) and provides an appropriate
advisory.

Below 0: "It's freezing! Wear warm layers."

0-10: "It's very cold. Wear a heavy jacket."

11-20: "It's cool. A light jacket would be good."

21-30: "It's pleasant. Enjoy the weather!"

Above 30: "It's hot. Stay hydrated!"

Q3:

Restaurant Tip Calculator

Scenario: A restaurant suggests tips based on service quality.

Task: Write a program that asks for the bill amount and service quality (Excellent, Good, Fair, Poor) an
calculates the suggested tip.

Excellent: 20% tip

Good: 15% tip


Fair: 10% tip

Poor: 5% tip

Q5:

Blood Donation Eligibility

Scenario: A blood donation camp screens donors based on basic criteria.

Task: Write a program that determines if a person is eligible to donate blood based on:

Age (must be 18-65)

Weight (must be above 50 kg)

Last donation (must be more than 3 months ago)

Q6:

Simple Car Insurance Premium Estimator

Scenario: A car insurance company determines premiums based on driver's age and car type.

Task: Create a program that estimates the premium:

Age below 25: High risk

Age 25-40: Medium risk

Age above 40: Low risk

Car types: Economy, Sedan, Luxury (increasing premiums in that order)

Q7:

ollege Admission Predictor

Scenario: A college has different admission criteria based on exam scores.

Task: Write a program that predicts admission chances based on exam score:

Below 60: "Admission unlikely"

60-79: "Admission possible"

80-89: "Admission probable"

90 and above: "Admission assured"


Q8:

Simple Loan Approval System

Scenario: A bank has basic criteria for loan approval.

Task: Create a program that determines loan approval based on:

Credit Score (Good/Fair/Poor)

Annual Income (Above/Below ₹500,000)

Employment Status (Employed/Self-employed/Unemployed)

Q9:

Mobile Plan Recommender

Scenario: A telecom company recommends plans based on usage.

Task: Write a program that suggests a plan based on monthly data usage:

0-2 GB: "Basic Plan"

2-5 GB: "Standard Plan"

5-10 GB: "Heavy User Plan"

Above 10 GB: "Unlimited Plan"

Q10:

Simple Health Risk Assessment

Scenario: A health app provides basic risk assessment based on BMI.

Task: Create a program that calculates BMI (weight in kg / (height in m)^2) and provides a health risk
assessment:

Below 18.5: "Underweight"

18.5-24.9: "Normal weight"

25-29.9: "Overweight"

30 and above: "Obese"


Problem 1: Discount Calculation Scenario:

A store is offering different discounts based on the purchase amount.

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.

If the amount is less than 1000, no discount is given.

Task: Write a program that takes the purchase amount as input and prints the applicable discount
percentage.

Problem 2: Traffic Light Signal Scenario:

You are writing a program for a traffic control system.

If the light is "Red," print "Stop."

If the light is "Yellow," print "Get ready."

If the light is "Green," print "Go."

Task: Take a color input from the user and print the appropriate message.

Problem 3: Eligibility for Loan Approval Scenario:

A bank wants to automate loan eligibility checks.

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.

Problem 4: Movie Ticket Pricing Scenario:

A cinema offers different ticket prices based on the customer's age.

If the age is below 5, the ticket is free.

If the age is between 5 and 12, the ticket price is $5.


If the age is between 13 and 60, the ticket price is $10.

If the age is above 60, the ticket price is $7.

Task: Write a program that takes the age as input and prints the ticket price.

Problem 5: Grade Calculator Scenario:

A school wants to calculate the grades of students based on their scores.

If the score is 90 or above, the grade is "A".

If the score is between 80 and 89, the grade is "B".

If the score is between 70 and 79, the grade is "C".

If the score is between 60 and 69, the grade is "D".

If the score is below 60, the grade is "F".

Task: Write a program that takes the score as input and prints the grade.

Problem 6: Temperature Classification Scenario: A weather station needs to classify temperature


ranges.

If the temperature is below 0°C, print "Freezing".

If the temperature is between 0°C and 15°C, print "Cold".

If the temperature is between 16°C and 30°C, print "Warm".

If the temperature is above 30°C, print "Hot".

Task: Write a program that takes the temperature as input and prints the classification.

Problem 7: Nested if for Password Strength Check Scenario:

A website requires users to create secure passwords.

If the password length is less than 8 characters, print "Weak password".

If the password length is 8 or more characters, check:

If it contains at least one number, print "Strong password".

Otherwise, print "Moderate password".


Task: Write a program that checks the strength of a password input.

Problem 8: Nested if for Loyalty Program Scenario:

A company runs a loyalty program with different benefits:

If the user is a "Gold" member:

If they have been a member for more than 5 years, print "Eligible for VIP access".

Otherwise, print "Eligible for premium rewards".

If the user is a "Silver" member:

Print "Eligible for basic rewards".

If the user is not a member, print "Not eligible for rewards".

Task: Write a program that takes membership type and years as input and prints the benefits.

Problem 9: Car Rental Eligibility Scenario:

A car rental service has specific requirements for renting a car:

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.

Problem 10: Shopping Cart Free Delivery Eligibility Scenario:

An online store provides free delivery only when certain conditions are met:

If the total order amount is above $100, print "Free delivery".

If the order amount is between $50 and $100 and the customer is a member, print "Free delivery".

If the order amount is below $50, print "Delivery charges apply".

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 the student has a grade of 'A':

• If they have participated in extracurricular activities, print "Eligible for scholarship".

• If they have not participated, print "Admitted without scholarship".

• If the student has a grade of 'B':

• If they have participated in extracurricular activities, print "Admitted with standard fee".

• If they have not participated, print "Considered for waitlist".

• 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.

Problem 12: Restaurant Discounts

Scenario: A restaurant offers different discounts based on customer loyalty and the total bill amount:

• If the customer is a loyalty member:

• If the bill is over $100, print "20% discount applied".

• If the bill is between $50 and $100, print "10% discount applied".

• If the bill is below $50, print "5% discount applied".

• If the customer is not a loyalty member:

• If the bill is over $100, print "10% discount applied".

• If the bill is between $50 and $100, print "5% discount applied".

• If the bill is below $50, print "No discount".

Task: Write a program that takes loyalty status and bill amount as input and prints the discount.

Problem 13: Smartphone Purchase Eligibility


Scenario: A store wants to determine if a customer is eligible for purchasing a smartphone on a
payment plan:

• If the customer has a credit score above 700:

• 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".

• If the credit score is between 600 and 700:

• Print "Eligible for payment plan with 10% interest".

• If the credit score is below 600:

• Print "Not eligible for a payment plan".

Task: Write a program that takes the customer's credit score and income as input and prints their
eligibility.

Problem 14: Parking Fee Calculation

Scenario: A parking lot charges different fees based on the type of vehicle and the duration of parking:

• If the vehicle is a car:

• If parking duration is less than 2 hours, print "Fee is $5".

• If parking duration is between 2 and 5 hours, print "Fee is $10".

• If parking duration is more than 5 hours, print "Fee is $20".

• If the vehicle is a bike:

• If parking duration is less than 2 hours, print "Fee is $3".

• If parking duration is between 2 and 5 hours, print "Fee is $6".

• If parking duration is more than 5 hours, print "Fee is $12".

• 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 the temperature is above 35°C:

• If it’s sunny, print "Heatwave alert: Stay hydrated and avoid outdoor activities".

• If it’s cloudy, print "Warm weather, stay indoors if possible".

• If the temperature is between 20°C and 35°C:

• Print "Comfortable weather, enjoy your day".

• If the temperature is below 20°C:

• If it’s raining, print "Cold and wet weather, carry an umbrella".

• If it’s not raining, print "Chilly weather, wear warm clothes".

Task: Write a program that takes temperature and weather condition as input and prints the
appropriate alert.

Problem 16: Online Exam Grading

Scenario: An online learning platform needs to grade students based on their exam scores and
attendance:

• If the score is greater than 90:

• If attendance is above 75%, print "Grade: A".

• If attendance is 75% or less, print "Grade: B".

• If the score is between 70 and 90:

• If attendance is above 75%, print "Grade: B".

• If attendance is 75% or less, print "Grade: C".

• If the score is below 70:

• Print "Grade: D".

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 speed is above 100 Mbps:

• 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 speed is between 50 Mbps and 100 Mbps:

• Print "Good speed for most users".

• If the speed is below 50 Mbps:

• 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.

Assignments using Tupes, List , Set and Dictionary

Tuples - User Profile Storage (Easy)

• 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.

2. List - Task Manager (Easy)

• 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.

3. Dictionary - Grocery Price Lookup (Easy)

• 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.

• Example: If a user inputs "Milk", display 50.


4. Set - Unique Student List (Easy)

• 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"}.

5. List & Dictionary - Student Grades (Medium)

• 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.

6. Set - Removing Duplicates in a Survey (Medium)

• 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.

• Example: From a list emails = ["[email protected]", "[email protected]",


"[email protected]"], output {"[email protected]", "[email protected]"}.

7. Dictionary - Library Book Collection (Medium)

• 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}.

8. List - Shopping Cart (Easy to Medium)

• 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.

9. Tuples & Dictionary - Employee Records (Medium)

• 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}

You might also like