Using for and while Loops
Programming Languages Basics for Business
Management Information Systems
Business School – University of Jordan
Objective
Practice using for and while loops in Python to repeat actions and process sequences.
Instructions
1. Print Numbers from 1 to 10 (using for loop)
Write a program that prints the numbers from 1 to 10 using a for loop.
Example Output:
1
2
3
...
10
2. Sum of Numbers from 1 to 100 (using while loop)
Write a program that calculates and prints the sum of numbers from 1 to 100 using a
while loop.
Example Output:
The sum is: 5050
3. Multiplication Table (using for loop)
Ask the user to enter a number, and print its multiplication table up to 10.
Example Output:
Enter a number: 5
5 x 1 = 5
5 x 2 = 10
...
5 x 10 = 50
4. Password Checker (using while loop)
Write a program that keeps asking the user to enter a password until they enter the correct
one (e.g., admin123).
Example Output:
Enter password: pass
Incorrect password. Try again.
Enter password: admin123
Access granted.
Submission Guidelines
Submit your code in a single .py
Use meaningful variable names and proper indentation.
Make sure to test each part of your code.
Add comments to explain logic where needed.
Best Regards
Prof Mahmoud Maqableh