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

PROJECT

The document describes a multipurpose software project that provides several applications like a calculator, string reversal, character to ASCII code conversion, checking if a string is a palindrome, checking if a number is Armstrong, finding prime factors of a number, playing a game, calculating a factorial, and calculating volumes and surface areas of 3D shapes. The project uses Python programming and provides details about the software, algorithms, source code, and outputs for each application.

Uploaded by

S. Lakshanya
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)
25 views

PROJECT

The document describes a multipurpose software project that provides several applications like a calculator, string reversal, character to ASCII code conversion, checking if a string is a palindrome, checking if a number is Armstrong, finding prime factors of a number, playing a game, calculating a factorial, and calculating volumes and surface areas of 3D shapes. The project uses Python programming and provides details about the software, algorithms, source code, and outputs for each application.

Uploaded by

S. Lakshanya
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/ 31

Computer Science Project

- Multipurpose Software

Project Done by:


Samanthula Lakshanya XIA2
GT ALOHA VIDHYA MANDIR
Neelankarai, Chennai – 600 115

CLASS - XI

CBSE

COMPUTER SCIENCE PROJECT


2023 – 2024

NAME : …………….………………………………………….……………...
REG NO. : ..........................................................................
BONAFIDE CERTIFICATE

Certified that this is a bonafide project work done by


............................................................ Reg
No.............................................of
Class XI, GT ALOHA VIDHYA MANDIR, NEELANKARAI, CHENNAI- 600
115, during the year 2023 – 2024.

Principal Teacher – In
– charge

Submitted for AISSCE Practical Examination held on


.............................in ___________at GT ALOHA VIDHYA MANDIR,
CHENNAI – 600 115.

INTERNAL EXAMINER EXTERNAL


EXAMINER

SCHOOL SEAL
Acknowledgement
I, ………………………………………………………………..of
Std XI , express my gratitude to our Principal,
Dr.J.Sundar for his continuous support and
encouragement.

I express my sincere thanks to


my COMPUTER SCIENCE TEACHER, Mr.Magesh
for helping me to complete this project
successfully.
Index
 Synopsis
 Software Used
Algorithm
 Source Code
 Output
 Bibliography
Synopsis
Multipurpose software is a type of software that
can perform multiple tasks or functions for the user.
Here, it provides the users many applications like
calculator,string reversal,conversion of character to
ASCII code and vice versa,to check number of vowels
and consonants, to check if a string is palindrome,to
check if a number is Armstrong,to get prime factors of a
number, to play a game, to get a factorial and calculate
volume and surface area of 3-D solids.
It can be useful for users who need to work on
different types of projects or tasks without switching
between different applications.
Software Used
Python IDLE is an integrated development environment
for Python programming. It is a graphical user interface
that allows users to write, run, debug, and test Python
code interactively. IDLE stands for Integrated
Development and Learning Environment, and it is part of
the standard Python distribution. IDLE has many
features that make it easy to learn and use Python, such
as syntax highlighting, code completion, indentation,
interactive shell, debugger, and more. IDLE is suitable for
beginners who want to learn the basics of Python, as
well as for experienced programmers who need a simple
and convenient tool for their projects
Algorithm
1. Calculator :
- Define a function that takes two numbers and an
operator as parameters.
- Use conditional statements to check which
operator is given and perform the corresponding
arithmetic operation on the numbers.
- Return the result of the operation or an error
message if the operator is invalid.
- Use a loop to prompt the user to enter two
numbers and an operator, separated by spaces.
- Call the function with the user input and print the
output.
- Exit the loop if the user enters 'q' or 'quit'..
2. String Reversal :
- Use slicing with a negative step.
- For example, if s is a string, then s[::-1] will return
the reversed string.
3. Conversion of character to ASCII code
- To convert a character to its ASCII code in Python,
you can use the ord() function.
4. Conversion of ASCII code to character
- To convert an ASCII code to its corresponding
character, you can use the chr() function.
5. To check number of vowels and consonants
- Define a set of vowels
- Define a function that takes a string as an
argument
- Loop through each character in the string
- Check if the character is a consonant
- Increment the consonant counter
- Return a tuple of vowel and consonant counts
6. To check if a string is palindrome
- Define a function that takes a string as an
argument.
- Reverse the string using slicing or a loop.
- Compare the original string and the reversed
string using the == operator.
- Return True if they are equal, False otherwise.

7. To check if a number is Armstrong


- Define a function that takes a number as a
parameter and returns the number of digits in it.
- Define another function that takes a number as a
parameter and returns the sum of its digits raised to the
power of the number of digits.
- In the main program, ask the user to enter a
number and store it in a variable.
- Call the second function with the user's number as
an argument and compare the result with the original
number.
- If they are equal, print that the number is
Armstrong, otherwise print that it is not.

8. To get prime factors of a number


- Initialize an empty list to store the factors
- Start with the smallest prime factor
- Loop until n is reduced to 1 or less
- If n is divisible by i, append i to the factors list and
divide n by i
- Otherwise, increment i by 1 and try again
- Return the factors list

9. To play a game
- Import the random module
- Generate a random number between 1 and 5
- Ask the user to enter their guess
- Check if the guess is equal to the number
- Print a success message
- Otherwise print a failure message and the
correct number.

10. To get factorial


- Define a function called factorial that takes a
parameter n.
- If n is zero or one, return one.
- Otherwise, return n multiplied by the factorial of n
minus one.
- Call the function with the desired number as an
argument and print the result.

11. Calculate volume and surface area of solids


- Use the math module to access some constants
and functions
- Define a function for each solid shape
- The function will take the parameters of the shape
and return a tuple of volume and surface area
Source Code
x=input('''what do you want to do:
1) Calculator
2) String reversal
3) Conversion of character to ASCII code
4) Conversion of ASCII code to character
5) To check number of vowels and consonants
6) To check if a string is palindrome
7) To check if a number is armstrong
8) To get prime factors of a number
9) To play a game
10) To get factorial
11) Calculate volume and surface area of solids
''')
import random
def rev(name):
l=len(name)
i=l-1
while(i>=0):
a=print(name[i],end="")
i=i-1

if x=="1":
x=input('''what do you want to do ?
add (+)
subtract (-)
multiply (*)
divide (/)
a raised to power b (power)
square root (sqrt)
cube root (cube root)
trigonometric function (trigo)
discount (disct)
table(table)
average(avg)
:''')
import math
you=math.pi
if x=='+' :
n=int(input("how many numbers you want to
add:"))
d=0
for i in range(0,n):
b=int(input('enter no. :'))
d=d+b
print('sum is :',d)
elif x=='-':
b=int(input('enter first no. :'))
c=int(input('enter second no. :'))
d=b-c
print('difference is :',d)
elif x=='*':
n=int(input("how many numbers you want to
multiply:"))
d=1
for i in range(0,n):
b=int(input('enter no. :'))
d=d*b
print('product is :',d)
elif x=='/':
b=int(input('enter first no. :'))
c=int(input('enter second no. :'))
d=b/c
print('division is :',d)
elif x=='power':
a=int(input('enter a:'))
b=int(input('enter b :'))
d=a**b
print(a,'raised to',b,' is :',d)
elif x=='sqrt':
a=int(input('enter number:'))
b=pow(a,0.5)
print('square root of',a,'is',b)
elif x=='cube root':
a=int(input('enter number:'))
b=pow(a,1/3)
print('cube root of',a,'is',b)
elif x=='trigo':
a=input('''which operation do you want to do
sin
cos
tan
cosec
sec
cot
:''')
b=float(input('enter angle in degree:'))
c=b*(you/180)
if a=='sin':
print('Sin of',b,'is:',math.sin(c))
elif a=='cos':
print('cos of',b,'is:',math.cos(c))
elif a=='tan':
print('tan of',b,'is:',math.tan(c))
elif a=='cosec':
d=1/math.sin(c)
print('cosec of',b,'is:',d)
elif a=='sec':
d=1/math.cos(c)
print('sec of',b,'is:',d)
elif a=='cot':
d=1/math.tan(c)
print('cot of',b,'is:',d)
else :
print(a,'is not a trigonometric function')
elif x=='disct':
a=int(input('enter amount:'))
if a>0:
b=int(input('enter disount in percentage:'))
c=(a*b)/100
d=a-c
print('discount:',c,'remaining amount:',d)
else:
print('enter valid discount amount')
elif x=="table":
u=int(input("upto how many digits you want
table:"))
n=int(input("enter number:"))
for i in range(1,u+1):
print(n,"*",i,"=",n*i)
elif x=="avg":
n=int(input("how many number's average you
want?"))
A=[]
for i in range (0,n):
z=int(input("enter number:"))
A.append(z)
B=0
for i in range(0,n):
S=A[i]
B=B+S
C=B/n
print("average is:",C)
elif x=="2":
n=input("enter text")
rev(n)
elif x=="3":
n=input("input character:")
l=len(n)
if l==1:
print("ascii code of",n,"is",ord(n))
else:
print("enter one character only")
elif x=="4":
n=int(input("input ascii code:"))
if n>=0 & n<=255 :
print("ascii code=",n)
print("character=",chr(n))
else :
print("enter number in renge 0-255")
elif x=="5":
n=input("enter word containing alphabets only:")
l=n.lower()
b=n.isalpha()
if b==True:
v=0
c=0
for ch in l:
if ch=="a" or ch=="e" or ch=="i" or ch=="o" or
ch=="u" :
v=v+1
else:
c=c+1
print("no. of vowels=",v)
print("no. of consonants=",c)
else:
print("enter single word containing alphabets only")
elif x=="6":
n=input("enter text").lower()
if n==n[::-1]:
print(n,"is palindrome")
else:
print(n,"is not palindrome")
elif x=="7":
d=0
n=int(input("enter number:"))
k=n
while n>0:
s=str(n)
l=len(s)
r=n%10
c=r**l
d=d+c
n=n//10
z=d
if z==k:
print(k,"is armstrong")
else :
print(k,"is not armstrong")
elif x=="8":
A=[]
B=[]
z=int(input("enter number"))
for k in range(2,z):
if z%k==0:
n=k
a=0
for i in range (2,n):
if n%i==0:
a=a+1
if a==0:
A.append(k)
print(A)
elif x=="9":
a=random.randint(1,6)
for i in range(1,5):
n=int(input("guess no. between 1 and 5:"))
if a==n:
print("you won")
break
else:
c=4-i
if c>0:
print("try again",c,"chances left")
else:
print("you lost")
elif x=="10":
a=1
n=int(input("enter number:"))
if n==0:
print("factorial of 0 is 1")
elif n>0:
for i in range(1,n+1):
a=a*i
print("factorial of",n,"is",a)
if x=="11":
e=1
while e!=0:
print("To calculate volumes and surface areas of
following shapes ")
print("1. Cube")
print("2. Cuboid")
print("3. Cylinder")
print("4. Cone")
print("5. Sphere")
print("6. Hemisphere")
print("0. Exit")
c = int(input("Type the serial number of the shape =
"))
if c>0 and c<7:
if c == 1 :
shape = "Cube"
a=int(input("Enter the value of side of the Cube
: "))
vol=a**3
sa=6*a**2
elif c == 2:
shape="Cuboid"
l=int(input("Enter the value of length of the
Cuboid : "))
w=int(input("Enter the value of width of the
Cuboid : "))
h=int(input("Enter the value of height of the
Cuboid : "))
vol=l*w*h
sa=l*w+l*h+w*h
sa=2*sa
elif c == 3:
shape = "Cylinder"
r = int(input("Enter the value of radius of the
Cylinder : "))
h = int(input("Enter the value of height of the
Cylinder : "))
vol=22/7*r**2*h
sa=r+h
sa=2*22/7*r*sa
elif c == 4:
shape = "Cone"
r = int(input("Enter the value of radius of the
Cone : "))
h = int(input("Enter the value of height of the
Cone : "))
vol=1/3*22/7*r**2*h
s1=(r**2+h**2)**0.5
sa=r+s1
sa=22/7*r*sa
elif c == 5:
shape="Sphere"
r=int(input("Enter the value of radius of the
Sphere: "))
vol=4/3*22/7*r**3
sa=4*22/7*r**2
elif c == 6:
shape="Hemisphere"
r=int(input("Enter the value of radius of the
Hemisphere : "))
vol=2/3*22/7*r**3
sa=3*22/7*r**2
print ("Choosen shape is ",shape)
print ("Volume of ",shape,"is =",vol)
print ("Surface Area of ",shape,"is =",sa)
print ("")
str =input("Press ENTER Key to continue")
elif c>6:
print("")
print("Please enter a valid serial number of the
shape")
print("")
e=c
if e==0:
break
Output
 When choice is 1

 When choice is +

 When choice is -
 When choice is *

 When choice is /

 When choice is power

 When choice is sqrt


CHOICE 1

CHOICE 2

 When choice is cube root


CHOICE 1

CHOICE 2

 When choice is trigo


 When choice is sin

 When choice is cos

 When choice is tan

 When choice is cosec

 When choice is sec

 When choice is cot

 When choice is disct


 When choice is table

 When choice is avg

 When choice is 2.

 When choice is 3.

 When choice is 4.

 When choice is 5.
CHOICE 1

CHOICE 2
 When choice is 6.
CHOICE 1

CHOICE 2

 When choice is 7.
CHOICE 1

CHOICE 2

 When choice is 8.
 When choice is 9.
CHOICE 1

CHOICE 2

 When choice is 10.

 When choice is 11.

 When choice is 1.
 When choice is 2.

 When choice is 3.

 When choice is 4.

 When choice is 5.

 When choice is 6.
 When choice is 0.
Bibliography
 Introduction to Python (w3schools.com)

You might also like