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

Selection Programming(If-else)

The document outlines ten Python programming tasks, including finding the greatest and smallest of three numbers, checking the equality of digit sums in a 4-digit number, calculating grades based on marks, determining leap years, converting time formats, classifying triangles, assessing weather based on temperature, identifying characters, checking divisibility, and applying discounts to product prices. Each task emphasizes the use of conditional statements to achieve the desired outcomes. These exercises are designed to enhance programming skills in Python.

Uploaded by

Seema Trivedi
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)
3 views

Selection Programming(If-else)

The document outlines ten Python programming tasks, including finding the greatest and smallest of three numbers, checking the equality of digit sums in a 4-digit number, calculating grades based on marks, determining leap years, converting time formats, classifying triangles, assessing weather based on temperature, identifying characters, checking divisibility, and applying discounts to product prices. Each task emphasizes the use of conditional statements to achieve the desired outcomes. These exercises are designed to enhance programming skills in Python.

Uploaded by

Seema Trivedi
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

1.

Write a Python program to input three numbers and display the greatest and smallest among them
using only if-else.

2. Take a 4-digit number and determine whether the sum of the first two digits is equal to the sum of
the last two digits.

3. Write a Python program to accept marks in 5 subjects, calculate the percentage, and assign a grade
using conditions:

100–90: A1

80–89: A2

70–79: B1

60–69: B2

50–59: C1

40–49: C2

Below 40: Fail

4. Input a year and check if it is a leap year and also check whether it is a century year or not.

5. Create a program to input time in 24-hour format and convert it to 12-hour format with proper AM or
PM label.

6. Take input for three sides of a triangle and check whether the triangle is:

Valid

And if valid, whether it's Equilateral, Isosceles, or Scalene

7. Take an input temperature and classify the weather:

≤ 0: Freezing

1–10: Cold

11–25: Pleasant

26–35: Warm

35: Hot

8. Input a character and check whether it is a vowel, consonant, or invalid (e.g., number or special
character).
9. Input a number and check whether it is divisible by both 5 and 7, by either one, or none.

10. Write a program to input the price of a product and apply:

20% discount if price > 10000

10% if 5000–9999

5% if 1000–4999

No discount otherwise

Then, print the final amount after discount.

You might also like