You are on page 1of 8

PM SHRI KENDRIYA VIDYALAYA

NO.1 PORT BLAIR


Internal Assessment 2023-2024
Subject: COMPUTER SCIENCE

C.S PROGRAMS

Submitted to Submitted by
MANOJ SIR EROTU.JASWANT
P.G.T – CS Roll no.-11A35
Class – XI ‘A’

1|Page
ACKNOWLEDGEMENT
I would like to express my gratitude to my teacher MANOJ Sir
Who gave me the amazing opportunity to do this wonderful
computer science Project on the topic “python programming”

Secondly I would also like to thank my parents and friends who


helped me a lot in finalizing this project within the limited time
frame.

- EROTU.JASWANT

2|Page
CERTIFICATE

This is to certify that EROTU.JASWANT of class 11 A has


successfully completed the Economics Project as per the guidelines of
class XI examination conducted by C.B.S.E.
It is further certifying that this project is the individual and
bonafide work of the candidate.

Teacher’sSign:…………………………………

Teacher’sName:………………………………

3|Page
CONTENTS

1. Write a program to input a welcome message and print it.

2. Program to obtain three numbers and print their sum.

3. Program to obtain length and breadth of a rectangle and


calculate its area.

4. Program to accept three integers and print the largest of


the three. Make use of only if statement.

5. Program that reads three numbers (integers) and prints


them in ascending order.

6. Program to input a number and test if it is a prime


number

7. Write a program to create a tuple with a single input


value.

8. Write a program to print the index of the minimum element in


a tuple.

9. Write a program to create a tuple with a single input value.

10 . Write a program to print the index of the minimum element in


a tuple.

4|Page
1. Write a program to input a welcome message and
print it.
ANS. message = input("Enter welcome message: ")
print("Hello,", message)

2. Program to obtain three numbers and print their


sum.
ANS. # to input 3 numbers and print their sum num1 =
int(input("Enter number 1: "))
num2 = int(input("Enter number 2: "))
num3 = int(input("Enter number 3 :"))
Sum = num1 + num2 + num3
print("Three numbers are : ", num1, num2, num3)
print("Sum is: ", Sum)

3. Program to obtain length and breadth of a rectangle


and calculate its area.
ANS. # to input length and breadth of a rectangle and
calculate its area
length = float(input("Enter length of the rectangle :"))
breadth = float(input("Enter breadth of the rectangle :"))
area = length * breadth
print ("Rectangle specifications ")
print ("Length = ", length, end = '')
print ("breadth = ", breadth)

5|Page
print ("Area = ‘’, area)

4. Program to accept three integers and print the


largest of the three. Make use of only if statement.
ANS. x=y=z= 0
x= float (input("Enter first number :"))
y= float (input("Enter second number :"))
z = float (input("Enter third number :"))
max = x
if y> max :
max = y
if z> max:
max = z
print ("Largest number is", max)

5. Program that reads three numbers (integers) and


prints them in ascending order.
ANS. x= int(input("Enter first number :"))
y = int(input("Enter second number :"))
z = int(input("Enter third number :"))
min = mid = max = None
if x < y and x <z:
if y<z:
min, mid, max = x, y, z
else:
min, mid, max = x, Z, y
elif y < x and y < z:

6|Page
if x <z:
min, mid, max = y, x, z
else:
min, mid, max = y, x, z
else:
if x< y :
min, mid, max = z, x,y
else:
min, mid, max = z, y, x
print ("Numbers in ascending order :", min, mid, max)

6. Program to input a number and test if it is a prime


number.
ANS. num = int(input("Enter number :"))
lim = int(num/2) + 1
for i in range (2, lim):
rem = num % i
if rem == 0:
print(num, "is not a prime number")
break
else:
print(num, "is a prime number")

7|Page
8. Program to print elements of a list [ 'q', 'w', 'e', 'r', 't', 'y' ]
in separate lines along with element's both indexes
(positive and negative).
ANS. L = [ 'q', 'w', 'e', 'r', 't', 'y']
length = len(L)
for a in range(length):
print("At indexes", a, "and", (a - length), "element
:", L[a])

9. Write a program to create a tuple with a single


input value.
ANS. t1=eval(input("Enter input for tuple: "))
print("Created tuple is: ", t1)

10. Write a program to print the index of the


minimum element in a tuple.
ANS. tup = eval(input("Enter a tuple: ")) mn = min(tup)
print("Minimum element", mn, \ "is at
index", tup.index (mn))

8|Page

You might also like