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

Python Assignments #4

The document provides instructions for practicing for and while loops in Python. It includes tasks such as printing numbers, calculating sums, generating multiplication tables, and creating a password checker. Submission guidelines emphasize meaningful variable names, proper indentation, testing, and commenting code.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views2 pages

Python Assignments #4

The document provides instructions for practicing for and while loops in Python. It includes tasks such as printing numbers, calculating sums, generating multiplication tables, and creating a password checker. Submission guidelines emphasize meaningful variable names, proper indentation, testing, and commenting code.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

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

You might also like