PRACTICAL FILE CBSE GRADE 12, Study Guides, Projects, Research of Computer science

PRACTICAL PROGRAMS GRADE 12 CBSE

Typology: Study Guides, Projects, Research

2020/2021

Uploaded on 09/11/2021

kanishka-aswani
kanishka-aswani 🇦🇪

5 documents

1 / 23

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
OUR OWN ENGLISH HIGH SCHOOL, SHARJAH
PRACTICAL RECORD BOOK
COMPUTER SCIENCE
KANISHKA LACHMAN ASWANI
12A
2021-2022
Our Own English High School,
Sharjah
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17

Partial preview of the text

Download PRACTICAL FILE CBSE GRADE 12 and more Study Guides, Projects, Research Computer science in PDF only on Docsity!

OUR OWN ENGLISH HIGH SCHOOL, SHARJAH

PRACTICAL RECORD BOOK

COMPUTER SCIENCE

KANISHKA LACHMAN ASWANI

12A

Our Own English High School,

Sharjah

Certificate

This is to certify that

___________________________ of class ________

Registration No. ______________ has

satisfactorily completed the practical file in

Computer Science during the academic year

2020-21 as prescribed by C. B. S. E, New

Delhi, India.

Date of Examination: __________

__________ ____________

Signature of Signature of

Teacher-in-charge External Examiner

PROBLEM NO: 1

DATE:13/04/

ODD AND EVEN CALCULATOR

Write a program that generates 100 random numbers and keeps a count of how

many of those random numbers are even and how many of them are odd.

SOURCE CODE:

import random def counter(): count=[] for k in range(100): count.append(random.randint(1,100)) odd= even= for num in count: if num in count: if num%2==0: even+= odd=100-even print("odd numbers:",odd,"even numbers:",even) counter()

SAMPLE OUTPUT:

PROBLEM NO:

DATE:15/04/

Grade and Grade-Point Calculator

Create an application in Python to display the report card of a student. Read

name of the student and marks for 5 subjects from user. Write user defined

function to calculate the Grade and Grade-point for each subject mark to display

in the report card.

SOURCE CODE:

def grades(g): if g in range(91,100): print("grade:a1,grade point:10.0") elif g in range(81,90): print("grade:a2,grade point:9.0") elif g in range(71,80): print("grade:b1,grade point:8.0") elif g in range(61,70): print("grade:b2,grade point:7.0") elif g in range(51,60): print("grade:c1,grade point:6.0") elif g in range(41,50): print("grade:c2,grade point:5.0") elif g in range(33,40): print("grade:d,grade point:4.0") elif g in range(21,32): print("grade:e1,grade point:0.0") elif g in range(00,20): print("grade:e2,grade point:0.0") name=input("enter the name of student:") chem=int(input("enter the marks in chem:")) grades(chem) maths=int(input("enter the marks in maths:")) grades(maths) phy=int(input("enter the marks in phy:"))

PROBLEM NO:

DATE:20/04/

Series Generator

Create two functions first one def factorial (n) which takes an argument and finds

the factorial of a number and returns an integer value. Second one def power (x,

n) which takes two arguments and calculate x2n. Write a program that finds the

following series, which invokes the above functions to find factorial and power.

SOURCE CODE:

def factorial(n): fact= for i in range(1,n+1): fact=k return fact def power (x,n): return x(2n) n=int(input("enter the number(n):")) x=int(input("enter the number(x):")) series= for k in range(1,n+1): series+=power(x,k)/factorial(k) print("sum is equal to:",series)

SAMPLE OUTPUT:

PROBLEM NO:

DATE:22/04/

Number checker Create following functions: a) def perfect(n) – to check whether a number is perfect or not, it returns True or False. b) def palindrome(n)- to check whether a number is palindrome or not. c) def armstrong(n) – to check whether a number is armstrong no or not. d) def is_Prime( n)- to check whether a number is prime or not and returns True, if the argument is prime number, or False otherwise. e) def automorphic(n) -to check whether a number is an automorphic number. A number is said to be an automorphic number if it contains last digit(s) of its square. E.g., 25 is automorphic number as its square is 625 and 25 is present in its last two digits. Write a menu driven program to call above functions based upon user’s choice.

SOURCE CODE:

def perfect():

sum=

for k in range(1,n):

if n%k==0:

sum+=k

return sum==n

def palindrome(n):

rev=

while n>0:

digit=n%

rev=rev*10+digit

n=int(n/10)

if n==rev:

print("the number is a palindrome")

else:

print("the number is not a palindrome")

def armstrong(n):

sum=

p=len(str(n))

while n>0:

print ("------MENU-----")

print("1)check whether a number is perfect or not")

print("2)check whether a number is palindrome or not")

print("3)check whether a number is armstrong or not")

print("4)check whether a number is prime or not")

print("5)check whether a number is an automorphic number")

print("6)exit")

print()

while true: ch=int(input("enter your choice")) print() if ch==1: n=int(input("enter the number:")) print(perfect(n)) print() if ch==2: n=int(input("enter the number")) palindrome(n) print() if ch==3: n=int(input("enter the number")) armstrong(n) print() if ch==4: n=int(input("enter the number") print(is_prime(n)) print() if ch==5: n=int(input("enter number")) print(automorphic(n)) print() if ch==6: print("exit program..") break

SAMPLE OUTPUT:

PROBLEM NO:

DATE:29/04/

COUNTER

Write menu driven program to input a string and invoke following functions

defined in your program:

a) def vowelcount(s) – to count and return the number of vowels.

b) def consonantcount(s) – to count and return the number of consonants.

c) def uppercount(s)- to count and return number of uppercase letters.

d) def lowercount(s)- to count and return number of lowercase letters.

SOURCE CODE:

def vowelcount(): count= for i in st: if i in"aeiouAEIOU": count=count+ print("the no of vowels are",count) def consocount(): count= for i in st: if i.isalpha(): if i not in "aeiouAEIOU": count=count+ print("the number of consonants",count) def uppercountt(): count= for i in st:

elif ch==5: break else: print("invalid choice")

SAMPLE OUTPUT:

PROBLEM NO:

DATE:4/05/

PALINDROME CHECKER

Create a function def palindrome() , to check whether passed string is palindrome. It

return True , if it is a palindrome otherwise False.

SOURCE CODE:

def palindrome(s): rev="" for i in range(len(s)-1,-1,-1): rev+=s[i] return rev==s s=input("enter the string") print(palindrome(s))

SAMPLE OUTPUT:

for i in st: copy+=i return copy def sconcat(st1,st2): st3="" for i in st1: st3+=i for j in st2: st3+=j return st print("-----MENU----") print("1-convert the string to uppercase") print("2-convert the string into lowercase") print("3-calculate the length of string") print("4-copy the string") print("concatenate two strings") print("exit") while True: ch=int(input("enter the choice")) if ch==1: st=input("enter the string") print("uppercase",uppit(st)) if ch==2: st=input("enter the string") print("lowercase",loit(st)) if ch==3: st=input("enter the string") print("length",length(st)) if ch==4: st=input("enter the string") print("copy",scopy(st)) if ch==5: st1=input("enter string1") st2=input("enter string2") print("new string",sconcat(st1,st2)) if ch==6:

print("exit") break

SAMPLE OUTPUT: