0% found this document useful (0 votes)
4 views2 pages

3717363-Python While Loops Basic

The document presents 10 practical Python questions focused on while loops, each designed to reflect real-world scenarios. Examples include ATM pin validation, password strength checking, and loan repayment simulation. These exercises aim to enhance understanding of while loops through engaging and relatable tasks.

Uploaded by

maisha4829.se24
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)
4 views2 pages

3717363-Python While Loops Basic

The document presents 10 practical Python questions focused on while loops, each designed to reflect real-world scenarios. Examples include ATM pin validation, password strength checking, and loan repayment simulation. These exercises aim to enhance understanding of while loops through engaging and relatable tasks.

Uploaded by

maisha4829.se24
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/ 2

10 practical Python questions based on While loops.

Each
question is designed to simulate real-world scenarios, making
the concepts relatable and engaging.
WHILE LOOP’s SCINARIO BASED QUESTIONS

1. ATM Pin Validation

Write a program to simulate an ATM that keeps asking the user for their PIN using a while loop.
The loop should terminate once the correct PIN is entered, or after 3 incorrect attempts.

2. Password Strength Checker

Write a program that takes a password as input and uses a while loop to ensure it meets the
following criteria:

At least 8 characters long


Contains both letters and numbers
Keep prompting the user until a valid password is entered.

3. Recharge Reminder

A prepaid mobile plan expires after X days. Use a while loop to count down the days, displaying a
reminder each day, until the plan expires. When the count reaches 0, display "Plan Expired."

4. Data Entry Validation

Write a program that continuously asks the user to input a valid email address using a while loop.
If the input is invalid, display an error message and prompt again.

5. Loan Repayment Simulation

Simulate loan repayment using a while loop. Start with a loan amount, subtract the monthly
payment each iteration, and display the remaining balance. Exit the loop when the loan is fully
repaid.
6. Quiz Game

Create a simple quiz game where the program keeps asking questions (e.g., "What is 5+3?") using
a while loop. Exit the loop if the user answers incorrectly or completes 5 questions correctly.

7. Temperature Check

A freezer stops working if the temperature exceeds a threshold (e.g., -5°C). Use a while loop to
simulate temperature readings every minute, and display a warning if the threshold is breached.

8. Parking Lot Availability

Simulate a parking lot with 10 available spaces. Use a while loop to keep accepting car entries and
decrement the space count. Stop the loop when no spaces are left.

9. Toll Booth Counter

Write a program for a toll booth that keeps track of the number of vehicles passing through and
stops collecting data when a user enters "stop." Display the total number of vehicles.

10. Shopping Budget Tracker

Simulate a shopping experience where the user has a limited budget. Keep allowing the user to
purchase items (by entering their price) using a while loop, and exit the loop when their budget is
exhausted.

You might also like