Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
24 views

Python Imp Programs For Unit Test 1 ( I scheme )

This document is a comprehensive assignment sheet designed to enhance Python programming skills through a series of exercises categorized by difficulty. It includes tasks ranging from basic syntax and control structures to advanced topics like object-oriented programming and data structures. Additionally, it presents various real-world problem scenarios for practical application of the learned concepts.

Uploaded by

rms744746
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views

Python Imp Programs For Unit Test 1 ( I scheme )

This document is a comprehensive assignment sheet designed to enhance Python programming skills through a series of exercises categorized by difficulty. It includes tasks ranging from basic syntax and control structures to advanced topics like object-oriented programming and data structures. Additionally, it presents various real-world problem scenarios for practical application of the learned concepts.

Uploaded by

rms744746
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Python

Important Programs

Volume 1

Designed by :

Ur Engineering Friend - Best E-Learning Platform For MSBTE

Explore More -:

Our Online Class ( 6th Sem ) - https://urengineeringfriend.in/best-


online-classes-for-msbte-diploma-msbte-next-icon/
Our Student’s Results -: https://urengineeringfriend.in/msbte-toppers-
from-ur-engineering-friend-classes/
Our Student’s Feedback -: https://urengineeringfriend.in/students-
feedback-from-ur-engineering-friend-course/
Join Free Whatsapp Group For 6th Sem -:
https://chat.whatsapp.com/LqKNC0Ds09o6IaQhRSodwS
This assignment sheet is designed to help students improve their Python programming
skills by categorizing questions into three levels of difficulty:

In this category, students will focus on strengthening their understanding of Python


syntax and basic programming constructs. These exercises will cover fundamental
topics like variable declarations, operators, control structures (if-else, loops), and
basic input/output operations. By completing these tasks, students will get a solid
foundation in Python programming, enabling them to write error-free code and
understand the language’s structure.

The logic building section challenges students to apply their knowledge of Python
syntax to solve more complex problems. This involves writing programs that require
thought processes such as decision making, loops, functions, and array manipulation.
Students will learn how to break down problems into logical steps and develop
solutions that are both efficient and effective. This category enhances problem-
solving skills and reinforces the application of core concepts learned in the first
section.

The advanced-level questions are designed for students who have a strong grasp of
basic Python concepts and are ready to tackle more intricate problems. These
assignments may include topics such as object-oriented programming (OOP), data
structures (arrays, linked lists, stacks, queues), algorithms, file handling, exception
handling, multi-threading, and more. These exercises will prepare students for real-
world applications by requiring them to implement more sophisticated solutions and
optimize performance.

Follow us on Youtube -: Ur Engineering Friend ( Click Here )


1. Write a simple program to take input from user and print the value in this format.
( a = 10 ).
2. Write a simple python program to check whether the given number is greater or
not . Take input from user.
3. Write a simple program to elaborate the use of conditional operator.
4. Write a simple program to print 1 to n using while , do while and for loop . Take n
from user.
5. Take a range of 1 to n using any loop and check any kind of condition (like even
odd , prime number etc.) and display the output accordingly.
6. Write a simple python program to print days using switch case.
7. Write a menu driven program for arithmetic operation using switch case but also
use do while loop for exit control.
8. Write any program to show case the use of break and continue.
9. Create a parametrized constructor to check whether the given number is positive or
negative.
10. Write a simple program to print “Ur Engineering Friend” using default constructor.
11. Write a simple program to create a list with 5 integer values and 5 double values
and traverse.
12. Write a program to create a list and add elements and remove elements.
13. Write a simple program to use any 5 string methods.
14. Write a program to declare, initialize, and print integer, float, and string variables.
15. Write a program to take user input for name, age, and marks, then display the
details.
16. Write a simple program to create dictionary for students marks and roll number.
17. Write a program to perform sets operations
18. Write a basic program to elaborate identity operator.
19. Write a program to implement any 4 list and tuples methods.
20. Write a python program to implement dictionary built-in methods.
1. Write a program to swap two numbers without using a third variable.
2. Write a program to check if a given number is even or odd using the modulus
operator.
3. Write a program to check whether a character is a vowel or consonant using if-else.
4. Write a program to check whether a person is underweight, normal, or overweight
based on BMI calculation using if-else.
5. Write a menu-driven program for an ATM machine with options like deposit,
withdraw, and check balance using switch-case.
6. Write a program to print a pattern using nested loops (e.g., a pyramid or a star
pattern).
7. Write a program to check whether a number is a palindrome using a loop.
8. Write a program to find the sum of the first 10 prime numbers using a loop.
9. Write a python program to find the second largest and second smallest element in
an array.
10. Write a python program to sort an list in ascending order without using built-in
methods.
11. Write a python program to remove duplicate elements from an list.
12. Write a python program to merge two sorted list into a single sorted list.
13. Write a python program to find the maximum and minimum values in a tuples
14. Write a python program to find the maximum and minimum values in a dictionary
15. Write a Python program to demonstrate the use of a parameterized constructor.
16. Write a program that takes a list of purchased items and their prices, then
calculates the total bill. Allow the user to add or remove items dynamically.
17. Store employee details (name, age, department, salary) in a tuple. Write a function
to display employee details but prevent modifications.
18. Write a program that takes a string input from the user and counts the frequency
of each word using a dictionary.
19. Implement a dictionary where products and their quantities are stored. Allow the
user to add new products, update quantities, and check stock levels.
20. Given a list of numbers from 1 to 100 with some missing, find the missing
numbers using a set.
21. Given a sentence, reverse the order of words while keeping the characters in the
words in the same order.
22. Write a program that takes a student's marks as input and assigns grades based on
the following conditions:

 Marks >= 90: A


 Marks >= 80: B
 Marks >= 70: C
 Marks >= 60: D
 Marks < 60: F

23. Write a program that takes a number (1-12) as input and prints the corresponding
month name using a dictionary-based switch.
24. Write a program that takes a tuple of numbers and returns the minimum and
maximum values.
25. Write a program that takes two lists as input and finds the common elements
between them without using sets.
1. Problem: Movie Ticket Booking System

Scenario: You are building a basic movie ticket booking system.

 There are n available seats in a theater, stored in a list (initially


marked as "Available").
 When a user books a ticket, the seat number should be marked as
"Booked".
 If a user cancels a ticket, the seat should be marked as "Available"
again.
 Display the list of available seats whenever required.

2. Problem: Stock Price Trend Analysis

Scenario: A stock market analyst wants to analyze stock price trends.

 A tuple (date, open_price, close_price, high, low) represents stock


data for each day.
 Given n days of data in a tuple of tuples, find the best day to buy and
sell to maximize profit.

3. Problem: Common and Unique Customers in Two Stores

Scenario: You have two e-commerce websites, and each store maintains a set
of unique customers (user IDs).
You want to analyze:

1. Customers who have shopped from both stores.


2. Customers exclusive to each store.
3. A new list of all customers from both stores.

4. Problem Lists: Flight Ticket Price Prediction


Scenario: A travel agency wants to analyze and predict flight prices based on
previous trends.

 You have a list of flight prices for the last n days.


 Implement a function to predict the next day's price using the moving
average of the last k days.
 Identify days with a sudden spike (where the price is more than 20%
higher than the previous day).
 Find the best day to book a flight by identifying the minimum price
over the last m days.

5. Problem : Sets: Cybersecurity – Detecting Unauthorized Login Attempts

Scenario: A company tracks employees logging into its system, but some
users attempt unauthorized access.
You have:

 A set of registered employees who are allowed to log in.


 A set of actual login attempts recorded by the system.

6. Problem: Traffic Signal Simulation

Scenario:
A city wants to simulate its traffic signal system. There are three signals:

 Red: Stop for 60 seconds


 Yellow: Prepare to stop for 5 seconds
 Green: Go for 30 seconds

7. Problem: Automated Toll Collection System

Scenario:
A toll plaza uses an automated system to charge vehicles based on their type.
The charges are:

 Car: ₹100
 Truck: ₹250
 Bike: ₹50
 Electric Vehicles (EV): ₹0 (free)

There is also a discount of 20% if the vehicle has a monthly pass.

8. Problem: Bank Loan Approval System

Scenario:
A bank wants to automate its loan approval process based on three criteria:

 Credit Score (out of 900)


 Annual Income
 Existing Loans

The rules for loan approval are:

1. If credit score > 750 AND income > ₹5,00,000 → Loan Approved ✅
2. If credit score between 600 and 750 AND income > ₹3,00,000 →
Loan Approved with Higher Interest.
3. If existing loans are too high, reject the loan.

9. Love Compatibility Algorithm (Loops & If-Else)

Scenario:

A dating app wants to calculate love compatibility between two people


based on the following criteria:

 If both partners like the same hobbies → +20 points


 If both have a similar daily routine (waking up and sleeping time
difference < 1 hour) → +30 points
 If one partner is an introvert and the other is an extrovert → -10
points (opposites might struggle)
 If the couple has been together for more than 3 years, increase
compatibility by 15%

10. Relationship Anniversary Reminder (Dates & Loops)

Scenario:

A boyfriend forgets anniversaries, so his girlfriend makes a Python script to


remind him.

 The program should calculate the number of days left until the next
anniversary.
 If today is the exact anniversary, print "Today is your anniversary!
Don't forget the gift! "
 If the anniversary is within 7 days, print "Time to plan something
special! "

11. Cheating Detection System

A college is implementing an anti-cheating system. The system tracks eye


movements during an exam and records the number of times a student looks
away from the screen.

Rules:

 If a student looks away more than 3 times, print "Warning:


Suspicious Activity Detected!"
 If a student looks away more than 5 times, print "Cheating
Confirmed! Exam Terminated."
 Otherwise, print "Continue Exam."

12. Proxy Attendance Detection

A professor wants to detect students marking proxy attendance. A list of roll


numbers is collected during class, but some roll numbers are repeated
(indicating cheating).

Task:

 Ask the user to enter roll numbers of N students.


 If a roll number appears more than once, print "Proxy Detected:
Roll Number X"
 If all roll numbers are unique, print "No Proxy Detected."

13. Answer Similarity Check

A professor suspects that students are copying each other’s answers. The
system compares students' answers and checks if they are too similar (above
80% match).

Task:

 Ask for two students' answers as strings.


 Check the percentage of matching words.
 If similarity is above 80%, print "Cheating Suspected!"
 Otherwise, print "Answers are unique."

14. A boyfriend wants to remember all the gifts his girlfriend mentioned wanting
for her birthday. Write a Python program that:

1. Allows the girlfriend to suggest up to 5 gift ideas (store these as key-


value pairs where the key is the gift name and the value is its
approximate price).
2. Calculates and displays:
1. The most expensive and least expensive gifts.
2. The total estimated cost of all gifts.
3. Suggests whether he should stick to the budget of ₹5000 or start
saving more!

15. A haunted house is filled with ghosts, and each ghost has a name that must be
decoded. Write a Python program that:

1. Takes a ghost's encoded name as input (e.g., "Gh!o$s@t%").


2. Removes all special characters and digits to reveal the true ghost name
(e.g., "Ghost").
3. If the name starts with the letter "B", displays a message like:
1. "This ghost is friendly!"
Otherwise, display:
2. "Run for your life!"
You can also join our Online Class to Score 95+ marks in

Check out all Results on our website

Our Online Class ( 6th Sem ) - https://urengineeringfriend.in/best-


online-classes-for-msbte-diploma-msbte-next-icon/
Our Student’s Results -: https://urengineeringfriend.in/msbte-toppers-
from-ur-engineering-friend-classes/
Our Student’s Feedback -: https://urengineeringfriend.in/students-
feedback-from-ur-engineering-friend-course/
Join Free Whatsapp Group -:
https://chat.whatsapp.com/IeJKgWugSBaIkFyouSGsnc

You might also like