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

Python Assignment 7

Uploaded by

sirohiriya5191
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)
17 views2 pages

Python Assignment 7

Uploaded by

sirohiriya5191
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

PYTHON WORKSHEET 7 – if..elif..

else statements

1. Check Positive, Negative, or Zero


Ask the user to enter a number.
Print 'Positive' if it’s greater than 0.
Print 'Negative' if it’s less than 0.
Print 'Zero' if it’s exactly 0.

2. Voting Age Checker


Ask the user to enter their age.
If they are 18 or older, print 'Eligible to vote'.
Otherwise, print 'Not eligible to vote'.

3. Pass or Fail
Ask the user to enter their marks.
If marks are 33 or more, print 'Pass'.
Else, print 'Fail'.

4. Check if Adult
Ask the user for their age.
If age is 18 or more, print 'You are an adult'.
Else, print 'You are not an adult'.

5. Check Day Name


Ask the user to enter a day name (like 'Monday', 'Tuesday', etc.).
If the day is 'Monday', print 'It's Monday!'.
If 'Tuesday', print 'It's Tuesday!', and so on...
Else, print 'Invalid day name'.

6. Check if Number is 100


Ask the user to enter a number.
If it is exactly 100, print 'You hit the century!'.
Else, print 'Not 100.'
7. Height Check for Ride
Ask the user to enter their height in cm.
If height is 120 or more, print 'You can go on the ride!'
Else, print 'You are too short for the ride.'

8. Smaller of Two Numbers


Take two numbers as input.
Print the smaller number.
If they are equal, print 'Both are equal.'

You might also like