0% found this document useful (0 votes)
2 views

Python Assignments #3

The document provides instructions for practicing conditional statements in Python, focusing on user input and fixed values. It includes tasks such as determining if a number is positive, negative, or zero, checking if a number is even or odd, implementing a grading system based on scores, and verifying if a year is a leap year. Submission guidelines emphasize correct logic, syntax, clear user input handling, and code documentation.
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)
2 views

Python Assignments #3

The document provides instructions for practicing conditional statements in Python, focusing on user input and fixed values. It includes tasks such as determining if a number is positive, negative, or zero, checking if a number is even or odd, implementing a grading system based on scores, and verifying if a year is a leap year. Submission guidelines emphasize correct logic, syntax, clear user input handling, and code documentation.
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

Conditional Statements (if, if…else, if…elif…else)

Programming Languages Basics for Business


Management Information Systems
Business School – University of Jordan

Objective

Practice using conditional statements in Python to make decisions based on user input or fixed
values.

Instructions

1. Positive or Negative Number


Write a Python program that asks the user to enter a number and prints whether it is
positive, negative, or zero using if…elif…else.

Example Output:

Enter a number: -5
The number is negative.

2. Even or Odd
Write a Python program that asks the user to enter a number and prints whether it is even
or odd using if…else.

Example Output:

Enter a number: 8
The number is even.

3. Grading System
Write a Python program that asks the user to enter their score (0–100), and then prints the
corresponding grade using if…elif…else:
o 90 and above → A
o 80–89 → B
o 70–79 → C
o 60–69 → D
o Below 60 → F

Example Output:

Enter your score: 85


Your grade is: B
4. Check if a Year is a Leap Year
Write a Python program that asks the user to enter a year and checks if it's a leap year. A
year is a leap year if:
o It's divisible by 4 and Not divisible by 100,
o Unless it is also divisible by 400.

Example Output:

Enter a year: 2024


2024 is a leap year.

Submission Guidelines

 Submit your solutions in a single .py


 Ensure correct logic and syntax.
 Make sure user input is handled clearly and outputs are formatted nicely.
 Use comments to explain your code where needed.
 Properly format and indent your code.

Best Regards
Prof Mahmoud Maqableh

You might also like