Scenario-based questions on Module -2
1). A website is creating a secure user registration system. To ensure security, the system must check
whether the password entered by a user is strong.
A password is considered strong only if it satisfies the following conditions:
It contains at least 8 characters, It contains at least one uppercase letter (A–Z), It contains at least one
lowercase letter (a–z), It contains at least one digit (0–9).
If the password does not meet all the above conditions, it should be considered weak.
Write a Python program to:
1. Accept a password from the user.
2. Check whether it satisfies all the above conditions.
3. Display "Strong Password" if all conditions are met.
4. Otherwise, display "Weak Password".
Implement the above program using string methods(i.e. islower(),isupper(),len(),isdigit() etc).
2) A college admission system allows students to register using specific email domains. The system
must validate the user's email address before completing the registration process.
An email address is considered valid only if:
It contains exactly one "@" symbol.
It does not contain any spaces.
It ends with any one of the following domains:
@[Link]
@[Link]
@[Link]
If the email satisfies all the above conditions, the program should display:” valid email,” otherwise,
“not a valid email.”
3). A news company is developing a text analysis tool to identify trending words in articles. The tool
must determine which word appears most frequently in a given paragraph.
Task:
Write a Python program to:
1. Accept a sentence or paragraph from the user.
2. Identify the word that occurs the highest number of times.
3. Display the most repeated word along with its frequency.
4). A school wants to maintain students' academic records using Python.
Write a Python program to perform the following tasks:
1. Read the number of students.
2. For each student:
Read the student name.
Read the number of subjects.
For each subject, read:
Subject name
Marks obtained
3. Store the details using a nested dictionary, where:
o The outer dictionary key is the student name.
o The inner dictionary contains subject names as keys and marks as values.
4. After storing all the data, display:
o Student name
o Subject-wise marks
o Total sum of the marks for each student
o Average marks of the student
5). A college maintains student records in the format (Roll_No, Name, Marks). Each student record is
stored as a tuple, and all the student records are stored together inside a list. Due to a system error,
some students have been entered more than once with the same Roll Number.
Write a Python program to accept the details of six students from the user and store each student’s
data as a tuple in the specified format. All the tuples must be stored inside a list. The program should
then identify and display any duplicate Roll Numbers that exist in the list. Finally, display only the
unique student records by removing duplicate entries based on the Roll Number. Duplicate detection
must be performed only by comparing the Roll Number (the first element of each tuple), without
modifying the tuple structure.
6). A company wants to maintain salary details of employees using a dictionary. The Employee ID
should be used as the key, and the value should contain the employee’s name, department, and
salary.
Write a Python program to accept details of four employees, store them in a dictionary, display the
employee with the highest & lowest salaries, and print the average salary of all employees.
7). A college stores student attendance records in a dictionary where the student name is the key and
the number of days present is the value. The total working days are 100. Students with attendance
below 75 days are not eligible for exams.
Write a Python program to accept attendance data and display the list of students who are not
eligible. Also display the percentage of attendance for each student.
8). A company is hiring for two different projects. The required skills for Project A and Project B are
stored in two separate sets. Some skills are common in both projects, while some are unique.
Write a Python program to accept the required skills for both projects and display the following:
The common skills required for both projects.
The skills required only for Project A.
The skills required only for Project B.
All unique skills required across both projects
9). A data entry system stores user activity logs in a list. Sometimes the same activity is recorded
multiple times consecutively due to a system glitch.
Write a Python program to accept a list of activities and remove only the consecutive duplicate
entries while keeping the original order unchanged.
Example:
Input: ["login", "login", "view", "view", "logout"]
Output: ["login", "view", "logout"]
10). An online store maintains a list of product prices added to a customer’s cart. If the total bill
exceeds 2000, a 10% discount should be applied.
Write a Python program to accept product prices into a list, calculate the total amount, apply the
discount if applicable, and display the final bill & after discount payable amount.