0% found this document useful (0 votes)
6 views12 pages

Python Practical File Class11 Clean

This document outlines the requirements for a Python practical file for Class XI, including submission guidelines and file preparation instructions. Students must complete 10 programs from a provided list, detailing aim, algorithm, code, and output for each. Coding guidelines emphasize proper syntax, indentation, and the use of comments.

Uploaded by

parveshyadav5000
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)
6 views12 pages

Python Practical File Class11 Clean

This document outlines the requirements for a Python practical file for Class XI, including submission guidelines and file preparation instructions. Students must complete 10 programs from a provided list, detailing aim, algorithm, code, and output for each. Coding guidelines emphasize proper syntax, indentation, and the use of comments.

Uploaded by

parveshyadav5000
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
You are on page 1/ 12

Python Practical File - Class XI

Last Date to Submit: 18th August (No late submissions will be accepted)

File Preparation

1. Use A4 sheet - left side blank (output), right side ruled (writing).

2. For each program write: Aim -> Algorithm -> Program -> Output.

3. Write neatly in blue pen, headings in black pen.

4. Paste output screenshot on blank side.

5. Keep programs in correct order, then bind with cover page.

Coding Guidelines

- Write Python keywords in lowercase (e.g., print, if, while).

- Maintain proper indentation (4 spaces or 1 tab for each level).

- Add comments in the code where necessary (e.g., # This program checks for

palindrome).

Complete any 10 programs from the following list.


1. Personal Details - Accept name, age, and city from the user and display them.

Algorithm:

Start

Accept name, age, and city from the user

Display the entered details

Stop

Code:
# Personal Details Program
name = input("Enter your name: ")
age = int(input("Enter your age: "))
city = input("Enter your city: ")
print("Name:", name)
print("Age:", age)
print("City:", city)
2. Greatest of Three Numbers - Find the largest number among three numbers entered by the
user.

Algorithm:

Start

Accept three numbers from the user

Compare the numbers using if-elif-else

Display the largest number

Stop

Code:
# Greatest of Three Numbers
a = int(input("Enter first number: "))
b = int(input("Enter second number: "))
c = int(input("Enter third number: "))
if a >= b and a >= c:
print("Largest number is:", a)
elif b >= a and b >= c:
print("Largest number is:", b)
else:
print("Largest number is:", c)
3. Grading System - Accept marks and display the grade according to given criteria.

Algorithm:

Start

Accept marks from the user

Check grade based on marks range

Display the grade

Stop

Code:
# Grading System
marks = int(input("Enter marks: "))
if marks >= 90:
grade = "A+"
elif marks >= 80:
grade = "A"
elif marks >= 70:
grade = "B"
elif marks >= 60:
grade = "C"
elif marks >= 50:
grade = "D"
else:
grade = "Fail"
print("Grade:", grade)
4. Sum of First N Natural Numbers - Using for loop.

Algorithm:

Start

Accept N from the user

Initialize sum = 0

Loop from 1 to N, add each number to sum

Display the sum

Stop

Code:
# Sum of First N Natural Numbers
n = int(input("Enter N: "))
total = 0
for i in range(1, n+1):
total += i
print("Sum of first", n, "natural numbers is:", total)
5. Multiplication Table - Display multiplication table of any number.

Algorithm:

Start

Accept a number from the user

Loop from 1 to 10

Multiply the number with loop counter and display

Stop

Code:
# Multiplication Table
num = int(input("Enter a number: "))
for i in range(1, 11):
print(num, "x", i, "=", num*i)
6. List Operations - Create a list, append and remove elements, and display the list.

Algorithm:

Start

Create an empty list

Append some elements

Remove an element

Display the list

Stop

Code:
# List Operations
my_list = []
my_list.append(10)
my_list.append(20)
my_list.append(30)
print("List after appending:", my_list)
my_list.remove(20)
print("List after removing 20:", my_list)
7. Largest Number in a List - Find the largest number from a list.

Algorithm:

Start

Create a list with numbers

Use max() function to find the largest number

Display the largest number

Stop

Code:
# Largest Number in a List
numbers = [5, 8, 12, 3, 9]
largest = max(numbers)
print("Largest number is:", largest)
8. Count Vowels in a String - Count and display the number of vowels in a string.

Algorithm:

Start

Accept a string from the user

Initialize vowel count to 0

Loop through each character, check if it's a vowel

Increment count if vowel

Display the count

Stop

Code:
# Count 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)
9. Simple Calculator - Perform addition, subtraction, multiplication, and division using
functions.

Algorithm:

Start

Define functions for each operation

Accept two numbers from the user

Perform each operation and display the result

Stop

Code:
# Simple Calculator
def add(x, y):
return x + y

def subtract(x, y):


return x - y

def multiply(x, y):


return x * y

def divide(x, y):


return x / y

a = float(input("Enter first number: "))


b = float(input("Enter second number: "))

print("Addition:", add(a, b))


print("Subtraction:", subtract(a, b))
print("Multiplication:", multiply(a, b))
print("Division:", divide(a, b))
10. Simple Interest Calculation - Accept principal, rate, and time, and display simple interest.

Algorithm:

Start

Accept principal, rate, and time from the user

Calculate simple interest using formula SI = (P*R*T)/100

Display the simple interest

Stop

Code:
# Simple Interest Calculation
p = float(input("Enter principal: "))
r = float(input("Enter rate: "))
t = float(input("Enter time: "))
si = (p * r * t) / 100
print("Simple Interest:", si)
11. Fibonacci Series - Display first N terms of the Fibonacci sequence.

Algorithm:

Start

Accept N from the user

Initialize first two terms as 0 and 1

Loop to generate next terms by adding previous two

Display the sequence

Stop

Code:
# Fibonacci Series
n = int(input("Enter number of terms: "))
a, b = 0, 1
if n <= 0:
print("Invalid input")
else:
print("Fibonacci sequence:")
for _ in range(n):
print(a, end=" ")
a, b = b, a + b

You might also like