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

Computer Science Practical Report 2024

The document is a practical file for Computer Science submitted by Pawan Kumar, a student of class XI-A at Vardaan International Academy for the academic year 2024-25. It includes a certificate of completion for 15 practicals, an index of practicals, and detailed programming examples for various tasks in Python. Additionally, it contains acknowledgments expressing gratitude to teachers, parents, and classmates for their support.

Uploaded by

indiamrbeast456
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)
12 views20 pages

Computer Science Practical Report 2024

The document is a practical file for Computer Science submitted by Pawan Kumar, a student of class XI-A at Vardaan International Academy for the academic year 2024-25. It includes a certificate of completion for 15 practicals, an index of practicals, and detailed programming examples for various tasks in Python. Additionally, it contains acknowledgments expressing gratitude to teachers, parents, and classmates for their support.

Uploaded by

indiamrbeast456
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

VARDAAN

INTERNATIONAL
ACADEMY

PRACTICAL FILE
COMPUTER SCIENCE

CODE:083

ACADEMIC YEAR: 2024-25

ROLL NO : 26

NAME : PAWAN KUMAR

CLASS : XI-A

SUBJECT : COMPUTER SCIENCE

SUBMITTED TO : Mr. Pankaj Sonkar

PGT (CS)

1
VARDAAN INTERNATIONAL ACADEMY

CERTIFICATE

This is to certify that Pawan Kumar student of class XI Roll No: 26 has successfully

completed the practical work in Computer Science (083) under guidance of Mr. Pankaj

Sonkar during the academic year 2024-25.

Number of practical’s certified 15 out of 15 in the subject of Computer Science.

Internal Examiner’s Signature Principal’s Signature

(Institution Rubber Stamp)

2
INDEX

3
S.
Page
No Name of the Practical Date Signature
No.
.
Input a welcome message and display it.
01 03-06-24 04
Input two numbers and display the larger /
02 smaller number. 06-06-24 05

Input three numbers and display the largest /


03 smallest number. 13-06-24 06

Generate the following pattern using nested loop:


*
* *
04 19-06-24 07
* * *
* * * *
* * * * *
Write a program to input the value of x and n and
05 print the sum of the following series: 27-06-24 08
1+x+x2+x3+x4+. .......... xn.
Determine whether a number is a perfect number,
06 08-07-24 09
an Armstrong number or a palindrome.
Input a number and check if the number is a
07 prime or composite number. 15-07-24 10

Display the terms of a Fibonacci series.


08 22-07-24 11

Compute the greatest common divisor and least


09 common multiple of two integers. 28-07-24 12

Count and display the number of vowels,


10 consonants, uppercase, lowercase characters in 05-08-24 13
string.
Input a string and determine whether it is a
11 palindrome or not; convert the case of characters 10-08-24 14
in a string.
12 Find the largest/smallest number in a list/tuple 18-08-24 15
Input a list/tuple of elements and search for a
13 given element in the list/tuple Python Program 25-08-24 16

Create a dictionary with the roll number, name


and marks of n students in a class and display the
14 30-08-24 17
names of students who have marks above 75.

Given two numbers and we have to design a


15 calculator type application that will perform add, 02-09-24 18
subtract, multiply and divide operations.

4
Program 1: Input a welcome message and display it.

# Program to input a welcome message and print it

message=input ("Enter welcome message: ")

# print() is a built function to print the message

print ("Hello,”, message)

OUTPUT:

5
Program 2: Input two numbers and display the larger / smaller number.

# Program Input two numbers and display the larger/smaller

a = float(input(" Please Enter the First Value : "))

b = float(input(" Please Enter the Second Value : "))

if(a > b):

print("{0} is Greater than {1}".format(a, b))

elif(b > a):

print("{0} is Greater than {1}".format(b, a))

else:

print("Both {0} and {1} are Equal".format(a,b))

OUTPUT:

6
Program 3: Input three numbers and display the largest / smallest number.

# Python program to find the largest number among the three input numbers

# Following lines to take three numbers from user

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

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

num3 = float(input("Enter third number: "))

if (num1 >= num2) and (num1 >= num3):

largest = num1

elif (num2 >= num1) and (num2 >= num3):

largest = num2

else:

largest = num3

print("The largest number is", largest)

OUTPUT:

7
Program 4: Generate the following pattern using nested loop.

* *

* * *

* * * *

* * * * *
# number of rows

rows = 5

for i in range(0, rows):

# nested loop for each column

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

# print star

print("*", end=' ')

# new line after each row

print("\r")

OUTPUT:

8
Program 5: Write a program to input the value of x and n and print the sum of
the following series:
n
1+x+x2+x3+x4+. .......... x .

# Program to input the value of x and n and print the sum of the series

x=float(input('Enter the value of x:'))

n=int(input('Enter the value of n (for x**n):'))

s=0

for a in range(n+1):

s+=x**a

print('Sum of first' ,n,'terms:',s)

OUTPUT:

9
Program 6: Determine whether a number is a perfect number, an Armstrong
number or a palindrome.
def palindrome(n):
temp = n
rev = 0
while n > 0:
dig = n % 10
rev = rev * 10 + dig
n = n // 10
if temp == rev:
print(temp, "The number is a palindrome!")
else:
print(temp, "The number isn't a palindrome!")
def armstrong(n):
count = 0
temp = n
while temp > 0:
digit = temp % 10
count += digit ** 3
temp //= 10
if n == count:
print(n, "is an Armstrong number")
else:
print(n, "is not an Armstrong number")
def perfect(n):
count = 0
for i in range(1, n):
if n % i == 0:
count = count + i
if count == n:
print(n, "is a Perfect number!")
else:
print(n, "is not a Perfect number!")
if __name__ == '__main__':
n = int(input("Enter number:"))
palindrome(n)
armstrong(n)
perfect(n)
OUTPUT:

10
Program 7: Input a number and check if the number is a prime or composite
number.
#Input a number and check if the no. is a prime or copmosite number

print("Input a number and check if the no. is a prime or composite no.\n")

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

if num>1:

for i in range(2,num):

if(num%i)==0:

print(num,"is NOT a prime number,it's composite number!!!")

break

else:

print(num,"is a PRIME number")

elif num==0 or 1:

print(num,"is a neither prime NOR composite number")

else:

print(num,"is NOT a prime number it is a COMPOSITE number")

OUTPUT:

11
Program 8: Display the terms of a Fibonacci series.

# Python program to print Fibonacci series’ first 20 elements.

first=0

second=1

print(first, end=' ')

print(second,end=' ')

for a in range(1,19):

third=first+second

print(third,end=' ')

first=second

second=third

OUTPUT:

12
Program 9: Compute the greatest common divisor and least common
multiple of two integers.
#Program to find GCD and LCM of two Numbers

print("Python Program to find GCD and LCM of two Numbers")

num1=int(input("Please Enter the First Value:"))

num2=int(input("Please Enter the Second Value:"))

a=num1

b=num2

lcm=0

while(num2!=0):

temp=num2

num2=num1%num2

num1=temp

gcd=num1

lcm=((a*b)/gcd)

print("\n HCF of",a,"and",b,"=",gcd)

print("\n LCM of",a,"and",b,"=",lcm)

OUTPUT:

13
Program 10: Count and display the number of vowels, consonants,
uppercase, lowercase characters in string.

#Count no. of vowels,consonants,uppercase,lowercase characters in string.

print("Count & Display the no. of vowels,consonants,uppercase & lowercase")


print("characters in string!!!!!")
str=input("Enter the string:")
vowels=0
consonants=0
uppercase=0
lowercase=0
for i in range(0,len(str)):
if(str[i].isupper()):
uppercase=uppercase+1
elif((str[i].islower())):
lowercase=lowercase+1
str=[Link]()
for i in range(0,len(str)):
if(str[i]=='a' or str[i]=='e' or str[i]=='i' or str[i]=='o' or str[i]=='u'):
vowels=vowels+1
elif((str[i]>='a' and str[i]<='z')):
consonants=consonants+1
print("Vowels:",vowels)
print("Consonants:",consonants)
print("Uppercase:",uppercase)
print("Lowercase:",lowercase)

OUTPUT:

14
Program 11: Input a string and determine whether it is a palindrome or not;
convert the case of characters in a string.

print("Input a string and determine whether it is palindrome or not;")


print("convert the case of characters in a string.\n")
string=input("Enter a string:")
j=len(string)-1
mid=len(string)//2
flag=True
for i in range(0,mid):
if(string[i]==string[j]):
flag=True
else:
flag=False
break
j=j-1
if(flag):
print("The string is a palindrome!")
else:
print("The string is not a palindrome!")
print("String after converting the case:",[Link]())

OUTPUT:

Program 12: Find the largest/smallest number in a list/tuple.

15
# creating empty list

listn = []

# Input number of elements to put in list

num = int(input("Enter number of elements in list: "))

# iterating till num to append elements in list

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

element= int(input("Enter elements: "))

[Link](element)

# print Smallest element

print("Smallest element in List is:", min(listn))


print("Largest element in List is:", max(listn))

OUTPUT:

16
Program 13: Input a list/tuple of elements and search for a given element in
the list/tuple Python Program

mylist = []

print("Enter 5 elements for the list: ")

for i in range(5):

value = int(input())

[Link](value)

print("Enter an element to be search: ")

element = int(input())

for i in range(5):

if element == mylist[i]:

print("\nElement found at Index:", i)

print("Element found at Position:", i+1)

OUTPUT:

17
Program 14: Create a dictionary with the roll number, name and marks of n
students in a class and display the names of students who have marks above
75.

no_of_std = int(input("Enter number of students: "))

result = {}

for i in range(no_of_std):

print("Enter Details of student No.", i+1)

roll_no = int(input("Roll No: "))

std_name = input("Student Name: ")

marks = int(input("Marks: "))

result[roll_no] = [std_name, marks]

print(result)

# Display names of students who have got marks more than 75

for student in result:

if result[student][1] > 75:

print("Student's name who get more than 75 marks is/are",(result[student][0]))

OUTPUT:

18
ACKNOWLEDGEMENT

I would like to express my gratitude towards my Computer Science Teacher


Mr. Pankaj Sonkar as well as our Principal [Link] Khanna who gave me
the opportunity to do this wonderful project. Their expertise and wisdom have
been indispensable in shaping the outcome of my project.

I am also grateful to my parents and classmates who helped me to complete this


project work successfully

19
ACKNOWLEDGEMENT

I would like to express my gratitude towards my Biology Teacher Mr. Pankaj


Sonkar as well as our Principal [Link] Khanna who gave me the opportunity
to do this wonderful project. Their expertise and wisdom have been indispensable
in shaping the outcome of my project.

I am also grateful to my parents and classmates who helped me to complete this


project work successfully.

You might also like