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

Python Programs for Grade 10 Students

This document contains a practical file for Grade 10 Python programs, featuring ten different programs. Each program addresses a specific task, such as calculating ticket prices, identifying character types, checking driving license eligibility, classifying triangles, calculating discounts, printing even numbers, calculating factorials, implementing a countdown timer, counting vowels in a string, and reversing a string. The document provides code snippets for each program along with user input prompts.

Uploaded by

hbvjtqtfqw
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)
5 views2 pages

Python Programs for Grade 10 Students

This document contains a practical file for Grade 10 Python programs, featuring ten different programs. Each program addresses a specific task, such as calculating ticket prices, identifying character types, checking driving license eligibility, classifying triangles, calculating discounts, printing even numbers, calculating factorials, implementing a countdown timer, counting vowels in a string, and reversing a string. The document provides code snippets for each program along with user input prompts.

Uploaded by

hbvjtqtfqw
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 PROGRAMS

GRADE 10 – PRACTICAL FILE

Program 1: Ticket Price Calculator


Write a program that asks the user for their age and prints the ticket price based on conditions.
age = int(input("Enter your age: ")) if age < 5: price = 0 elif 5 <= age <= 12:
price = 5 elif age >= 65: price = 8 else: price = 12 print("Ticket Price: $", price)

Program 2: Character Type Identifier


Ask the user to enter a single character and identify its type.
ch = input("Enter a character: ") if 'A' <= ch <= 'Z': print("Uppercase Letter")
elif 'a' <= ch <= 'z': print("Lowercase Letter") elif '0' <= ch <= '9':
print("Digit") else: print("Special Character")

Program 3: Driving License Eligibility


Check if the user is eligible for a driving license based on age and course completion.
age = int(input("Enter your age: ")) course = input("Completed driving course?
(yes/no): ") if age >= 18 and [Link]() == "yes": print("You are eligible for a
driving license.") else: print("You are not yet eligible for a driving license.")

Program 4: Triangle Type Classifier


Determine triangle type based on three side lengths.
a = float(input("Side 1: ")) b = float(input("Side 2: ")) c = float(input("Side 3:
")) if a + b > c and a + c > b and b + c > a: if a == b == c: print("Equilateral
Triangle") elif a == b or b == c or a == c: print("Isosceles Triangle") else:
print("Scalene Triangle") else: print("Invalid Triangle Sides")

Program 5: Discount Calculator


Calculate discount based on purchase amount.
amount = float(input("Enter purchase amount: ")) if amount >= 500: discount = 0.20
elif 200 <= amount <= 499: discount = 0.10 else: discount = 0 final_amount = amount
- (amount * discount) print("Final Amount:", final_amount)

Program 6: Even Numbers in a Range


Print all even numbers between a given range.
start = int(input("Enter start number: ")) end = int(input("Enter end number: "))
for i in range(start, end + 1): if i % 2 == 0: print(i)

Program 7: Factorial Calculator


Calculate factorial using a loop.
n = int(input("Enter a non-negative integer: ")) fact = 1 for i in range(1, n+1):
fact *= i print("Factorial:", fact)
Program 8: Countdown Timer
Countdown from a number to 1.
start_value = int(input("Enter start value: ")) for i in range(start_value, 0, -1):
print(i) print("Blast Off!")

Program 9: Count Vowels in a String


Count number of vowels in a string.
text = input("Enter a string: ") vowels = "aeiouAEIOU" count = 0 for ch in text: if
ch in vowels: count += 1 print("Number of vowels:", count)

Program 10: Reverse a String


Reverse a string using a loop (without slicing).
text = input("Enter a string: ") rev = "" for ch in text: rev = ch + rev
print("Reversed string:", rev)

You might also like