Sophia Girls' Senior Secondary School Saharanpur Computer Science (083) Practical File For Class-Xi SESSION:-2020-2021
Sophia Girls' Senior Secondary School Saharanpur Computer Science (083) Practical File For Class-Xi SESSION:-2020-2021
Sophia Girls' Senior Secondary School Saharanpur Computer Science (083) Practical File For Class-Xi SESSION:-2020-2021
SAHARANPUR
Yours truly
Anushka Chauhan
Teacher’s sign.
(Mrs.Renuka Bhateja)
PGT(Comp.Sc)
ACKNOWLEDGEMENT
I would like to express my special thanks of gratitude to
our principal Sister.Lucy who gave me the golden
opportunity to do this wonderful project of computer
science(083) through which I came to know about so
many new things.
Anushka Chauhan
XI C
INDEX
(1) Cover page
(2) Certificate
(3) Acknowledgement
(4) Program to compute Simple and compound interest
(5) Program to find area of triangle
(6) Program to print the script
(7) Program to check the range
(8) Program to take integer n and print Fibonacci series
(9) Program to input 3 nos. and display the largest and smallest
number.
(10) Program to calculate x^n
(11) Program to display the terms of Fibonacci series
(12) Program to compute HCF and LCM of 2 integers
(13) Program to find largest/smallest no. in list/tuple
(14) Program to swap the elements.
(15) Program to input a list/tuple of elements,search for a given
list/tuple
(16) Program to create a dictionary
(17) Program to perform four tasks
(18) Program to check the password
(19) Program to print the sum of the series
(20) Program to determine whether a number perfect,
Armstrong or palindrome
(21) Program to input a string determine whether it is
Palindrome or not
(22) Program to count and display the number of vowels,
consonants,uppercase,lowercase characters in string.
(23) Program to input a list and test if it is equal to the sum of the
cubes of its digit and find smallest and largest number from list
CONCLUSION
Here, I have came to the end of the project of Computer
Science of Python of (083) code. It was a wonderful and
learning experience for me while working on this
project.This project took me through the various phases
of project development.I enjoyed each and every bit of
work I had put into this project.
BIBLIOGRAPHY
The content for this project report has been
taken from the following sources:
www.google.com
Taken source from a source book
“Computer Science With Python”
Written by Preeti Arora.
And taken help of our computer teacher
Mrs.Renuka Bhateja.
Program 1:Write a program to compute simple interest and
compound interest.
Solution input:
#Simple and Compound interest
#Reading principal amount,rate and time
principal=float(input('Enter amount:'))
time=float(input('Enter time:'))
rate=float(input('Enter rate:'))
#Calculation
simple_interest=(principal*time*rate)/100
compound_interest=principal*( (1+rate/100)**time-1)
#Displaying result
print('Simple interest is:%f'%(simple_interest))
print('Compound interest is:%f'%(compound_interest))
Program 1:Output
Enter amount:30
Enter time:5
Enter rate:20
Simple interest is:30.000000
Compound interest is:44.649600
Program 2:Write a program to find the area of a triangle using
formula ½*base*height.
Solution input:
#Python Program to find area of a triangle using base and
height
Program 2:Output
Program3:Output
8
86
864
8642
Program4:Write a program that checks in the range 1………100
and prints the “Fizz” if the number is multiple of 3 and prints
“Buzz” if the number is multiple of 5.It should print “Fizz Buzz” if
the number is multiple of both 3 and 5.
Solution input: for fizzbuzz in range(101):
if fizzbuzz%3==0 and fizzbuzz%5==0:
print("fizzbuzz")
continue
elif fizzbuzz %3==0:
print("fizz")
continue
elif fizzbuzz %5==0:
print("buzz")
continue
print(fizzbuzz)
Program4:Output
fizzbuzz
1
2
fizz
4
buzz
fizz
7
8
fizz
buzz
11
fizz
13
14
fizzbuzz
16
17
fizz
19
buzz
fizz
22
23
fizz
buzz
26
fizz
28
29
fizzbuzz
31
32
fizz
34
buzz
fizz
37
38
fizz
buzz
41
fizz
43
44
fizzbuzz
46
47
fizz
49
buzz
fizz
52
53
fizz
buzz
56
fizz
58
59
fizzbuzz
61
62
fizz
64
buzz
fizz
67
68
fizz
buzz
71
fizz
73
74
fizzbuzz
76
77
fizz
79
buzz
fizz
82
83
fizz
buzz
86
fizz
88
89
fizzbuzz
91
92
fizz
94
buzz
fizz
97
98
fizz
buzz
>>>
Program5:Take an integer input N from the user print N
Fibonacci numbers.Recall that fibanocci series progresses as 0 1
1 2 3 5 8……..
Solution input: #Python program to generate Fibonacci series
until 'n' value
n=int(input("Enter the value of 'n'"))
a=0
b=1
sum=0
count=1
print("Fibonacci Series:",end = " ")
while(count <=n):
print(sum,end= " ")
count += 1
a=b
b=sum
sum=a+b
Program5:Output
def largest(num1,num2,num3):
if(num1 > num2)and(num1 > num3):
largest_num=num1
elif(num2 > num1)and(num2 > num3):
largest_num = num2
else:
largest_num = num3
print("The largest of the 3 numbers is:",largest_num)
def smallest(num1,num2,num3):
if(num1 < num2)and(num1 < num3):
smallest_num=num1
elif(num2 < num1)and(num2 < num3):
smallest_num = num2
else:
smallest_num = num3
print("The smallest of the 3 numbers is:",smallest_num)
largest(number1,number2,number3)
smallest(number1,number2,number3)
Program6:Output
def power(x,n):
if(n==0):return 1
elif(int(n%2)==0):
return(power(x,int(n/2))*
power(x,int(n/2)))
else:
return(x*power(x,int(n/2))*
power(x,int(n/2)))
x=2;n=3
print(power(x,n))
Program7:Output
8
Program8:Display the terms of a Fibonnaci series.
Solution input: #Python program to display the terms of a
fibonacci series.
a=int(input("Enter the terms:"))
f=0
s=1
if a<0:
print("The requested series is",f)
else:
print(f,s,end=" ")
for x in range(2,a):
next=f+s
print(next,end=" ")
f=s
s=next
Program8:Output
lcm=first*second/find_gcd(first,second)
print('LCM of %d and %d is %d' %(first,second,lcm))
Program9:Output
for n in range(num):
numbers=int(input('enter number'))
lst.append(numbers)
Program10:Output
print(Output)
Program12:Output
Program13:Output
Enter n:3
enter roll no:1
Enter name:Aayushi
Enter marks:90
enter roll no:2
Enter name:Amisha
Enter marks:70
enter roll no:3
Enter name:Amyra
Enter marks:33
Aayushi
Program14:Write a python program that should perform the
following four tasks:
(i)After getting a word from the user ,your program should print
each letter of the word.
(ii)Your program should use another loop to print each letter of
the word in reverse.
(iii)Make a new variable that is the original word in reverse and
print that variable.You can use ‘string slice’.
(iv)Ask the user for a letter to count.Use another loop to count
how many times that letter appears in the original word.Print
this count.
for i in word:
a=word.index(i)
print(word[l-a-1])
print()
reverse=word[::-1]
print(reverse,'is the original word in reverse')
print()
Program14:Output
enter a word:Python
P
y
t
h
o
n
loop in reverse:
n
o
h
t
y
P
Program15:Output
Enter the password:kaushik30
Password incorrect.Password must start with a digit
Program16:Output
Program17:Output
Enter a number:407
407 is an Armstrong number
The number is not a perfect number
The number is not a palindrome
Program18:Input a string a determine whether it is a
palindrome or not;convert the case of characters in a string.
Program18:Output
vowels=0
consonant=0
lower=0
upper=0
for i in range(0,len(str)):
ch=str[i]
if((ch>='a' and ch<='z') or (ch>='A' and ch<='Z')):
ch=ch.lower()
if(ch=='a' or ch=='e' or ch=='i' or ch=='o' or ch=='u'):
vowels+=1
else:
consonant+=1
for i in range(0,len(str)):
ch=str[i]
if(ch>="a" and ch<="z"):
lower=lower+1
elif(ch>="A" and ch<="Z"):
upper=upper+1
print("Vowels:",vowels)
print("Consonant:",consonant)
print("Lower Case Letters:",lower)
print("Upper Case Letters:",upper)
Program19:Output
Enter a string:Motivate
Vowels: 4
Consonant: 4
Lower Case Letters: 7
Upper Case Letters: 1
Program20:Input a list of numbers and test if a numbers is equal
to the sum of the cubes of its digits.Find the smallest and largest
such number from the given list of numbers.
return sumc == n
num_list=[587,742,15,441,919,782,153,318,688,556,407]
pass_lst=[i for i in num_list if cube_sum(i)]
if pass_lst:
print("list of qualified numbers:",pass_lst)
print("Max:",max(pass_lst))
print("Min:",min(pass_lst))
else:
print("No number in the list is qualified")
Program20:Output