0% found this document useful (0 votes)
17 views20 pages

Xi Program List Term 1

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)
17 views20 pages

Xi Program List Term 1

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/ 20

SHRISHTI VIDYASHRAM SR.SEC.

SCHOOL VELLORE

XI COMPUTER SCIENCE (PRACTICAL FILE)

1.Write a program to enter 3 number and print the largest number

AIM: Program to enter 3 number and print the largest number

PROGRAM:

n1=int(input("Enter the first no.:"))

n2=int(input("Enter the second no.:"))

n3=int(input("Enter the Third no.:"))

large=n1

if(large<n2):

large=n2

if(large<n3):

large = n3

print("Largest Number is:",large)

OUTPUT
2. Write a program to enter any number and check it is even or odd

Aim: python program to enter any number and check it is even or Odd

PROGRAM:

num=int(input("Enter the number:"))

if num%2==0:

print(num,"is a EVEN number")

else:

print(num,"is a ODD number")

OUTPUT:
3. A Python program to input temperature of water and print its physical statement

Aim: Python program to input temperature of water and print its physical statement

PROGRAM:

temp = int(input("Enter the temperature of water:"))

if temp>100:

print("Gaseous State:")

elif temp<=0:

print("Solid State")

else:

print("Liquid State")

OUTPUT:

\
4. USING ARITHMETIC OPERATORS:

AIM: USING ARITHMETIC OPERATORS:

PROGRAM:

num1=int(input("Enter the num1:"))

num2=int(input("Enter the num2:"))

add=num1+num2

sub=num1-num2

multi=num1*num2

div=num1/num2

rem=num1%num2

exp=num1**num2

flo=num1//num2

print("addition:",add)

print("subtraction:",sub)

print("Multiplication:",multi)

print("Division:",div)

print("Remainder:",rem)

print("exponent:",exp)

print("Floor division:",flo)
OUTPUT:
5. Write a Python Program to calculate the Simple Interest

Aim: Simple Interest Calculation

PROGRAM:

p=int(input("Enter the Principal:"))

n=int(input("Enter the No of Years:"))

r=int(input("Enter the Rate of interest:"))

si= (p*n*r)/100

print("SIMPLE INTEREST IS:",si)

OUTPUT:
6. Input a number and check if the number it is a prime number or not(composite
number):

AIM: Input a number and check if the number it is a prime number or not(composite
number)

PROGRAM:

num=int(input("enter any number"))

lim=num//2+1

for i in range(2,lim):

rem=num%i

if rem==0:

print(num,"is not a PRIME NO. is a composite number")

break

else:

print(num,"Is A PRIME NO.")


7.GENERATE THE FOLLOWING PATTERNS USING NESTED LOOPS

AIM: Generate the patterns using nested loops

PROGRAM: (3.A)

for i in range(1,10):

for j in range(1,i+1):

print(j,end='')

print()

PROGRAM(3.B)

for i in range(1,10):

for j in range(1,i+1):

print('*',end='')

print()

PROGRAM:(3.C)

for i in range(9,0,-1):

for j in range(i,0,-1):

print(j,end='')

print()
OUTPUT: (3.A)

OUTPUT (3.B)

OUTPUT: (3.C)
8.To write a python program to check whether the given number is perfect or not.

Aim: A python program to check whether the given number is perfect or not.

PROGRAM:

n=int(input("Enter any number: "))

sum=0

for i in range(1,n):

if n%i==0:

sum=sum+i

if sum==n:

print("Perfect number! ")

else:

print("not a perfect number")

OUTPUT
9.WAP to An Armstrong number has sum of the cubes of the digits is equal to the
number itself

Aim: An Armstrong number has sum of the cubes of the digits is equal to the number
itself.

PROGRAM:

no=int(input("Enter any Three digits number to check: "))

no1=no

sum=0

while(no>0):

ans=no%10

sum=sum+(ans*ans*ans)

no=int(no/10)

if sum==no1:

print("Armstrong number!")

else:

print("Not an Armstrong number")

OUTPUT:
10.To write a python program to find the factorial of the given number.(for ..Loop,While
loop)

AIM: Python program to find the factorial of given number using (for.. Loop and While
loop.

PROGRAM:

#(Using for …. Loop)

num=int(input("Enter the number for calculating its factorial: "))

fact=1

for i in range(1,num+1):

fact=fact*i

print("The factorial of",num,"=",fact)

PROGRAM:

#(Using while …. Loop)

num=int(input("Enter the number for calculating its factorial: "))

fact=1

i=1

while i<=num:

fact=fact*i

i=i+1

print("The factorial of",num,"=",fact)


OUTPUT:
11. Write a python program to prepare the student marklist. Enter the student name,
roll no and all subjects marks and calculate total ,avg and grade.

Aim:

python program to prepare the student marklist . Enter the student name, roll no and all
subjects marks to calculate total ,avg and grade

PROGRAM:

name=input("Enter the name:")

rollno=int(input("Enter the roll no:"))

eng=int(input("Enter the English Mark:"))

phy=int(input("Enter the physics Mark:"))

che=int(input("Enter the chemistry Mark:"))

mat=int(input("Enter the Math Mark:"))

csc=int(input("Enter the computer Mark:"))

total= eng+phy+che+mat+csc

avg=total/5

print()

print("Name:",name)

print("Roll No:",rollno)

print("English:",eng)

print("Physics:",phy)

print("Chemistry:",che)

print("Maths:",mat)

print("Computer Science:",name)

print("Total:",total)

print("Average:",avg)
if avg>=60:

print("Result: First Class")

elif avg>=45:

print("Result: Second class")

elif avg>=33:

print("Result: Third Class")

else:

print("Result: FAIL")

OUTPUT:
12.To write a python program to print the Fibonacci series for the given number of

terms.

AIM: a python program to print the Fibonacci series for the given number of

terms.

PROGRAM:

i=int(input("Enter the limit: "))

x=0

y=1

z=1

print("Fibonacci Series \n")

print(x,y,end=" ")

while(z<=i):

print(z,end=" ")

x=y

y=z

z=x+y

OUTPUT:
13.To write a python program to check whether the given string is palindrome or not.

AIM: A python program to check whether the given string is palindrome or not

PROGRAM:

def isPanlindrome(s):

return s==s[::-1]

s=str(input("Enter the string data: "))

ans=isPanlindrome(s)

if ans:

print("Given string is a Palindrome")

else:

print("Given string is NOT a Palindrome")

OUTPUT:
14. WAP TO CHECK ENTERED YEAR IS LEAP YEAR OR NOT

AIM: To check entered year is leap year or Not

PROGRAM:

year=int(input("Enter any year:"))

if year%100==0:

if year%400==0:

print(year,"year is Leap Year:")

else:

print(year,"year is NOT Leap Year:")

elif year%4==0:

print(year,"year is Leap Year:")

else:

print(year,"year is NOT Leap Year:")

OUTPUT:
15. WAP that counts the number of alphabets and digits, uppercase letters, lowercase letter, spaces and
other characters in the string entered

AIM: counts the number of alphabets and digits, uppercase letters, lowercase letter, spaces and other
characters in the string entered

PROGRAM:

str1=input("Enter a String:")

N=C=D=S=U=L=OT=0

for ch in str1:

if ch.isalnum():

N+=1

if ch.isupper():

U+=1

elif ch.islower():

L+=1

elif ch.isalpha():

C+=1

if ch.isdigit():

D+=1

elif ch.isspace():

S+=1

else:

OT+=1

print("No of Alphabets and Digits",N)

print("No of Capital Alphabets ",U)

print("No of Small Alphabets ",L)

print("No of Digits",D)

print("No of Spaces",S)

print("No of OTher characters",OT)


OUTPUT:

You might also like