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

Report File 1

The document is a certificate for a student named Saharsh Kumar of class XI A with roll number studying at The Aryans' School in Jhansi. It certifies that the student has completed 20 practicals in the subject of Computer Science for the academic year 2023-24. It is signed by the teacher in charge and principal with the institution's rubber stamp dated.

Uploaded by

saharshkumar1107
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)
22 views

Report File 1

The document is a certificate for a student named Saharsh Kumar of class XI A with roll number studying at The Aryans' School in Jhansi. It certifies that the student has completed 20 practicals in the subject of Computer Science for the academic year 2023-24. It is signed by the teacher in charge and principal with the institution's rubber stamp dated.

Uploaded by

saharshkumar1107
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/ 41

CERTIFICATE

Name:-Saharsh Kumar Class:-XIth A


Roll No.:-
Institution:- The Aryans’ School, Jhansi
This is certified to be the bonafide work of the
student in the Computer Laboratory during the
academic year2023-24
No. of practicals certified 20/20 in the subject of
Computer Science(083).

…………………….......
Teacher Incharge

……………….………………
………………………………
Examiner’s Signature Principal’s Signature

Date:- …………………. Institution Rubber Stamp


Output

================ RESTART:
C:\Users\LENOVO\Desktop\Saharsh\p1.py ================
Enter the principle amount:200
Enter the time in years:5
Enter the rate:4
The simple interest is: 40.0
#CODE 1
p=float(input("Enter the principle amount:"))
t=int(input("Enter the time in years:"))
r=float(input("Enter the rate:"))
si=(p*t*r)/100
print("The simple interest is:",si)
Output
= RESTART:
C:\Users\LENOVO\Desktop\Saharsh\p2.py
Enter seconds: 256
4 minutes and 16 seconds
#CODE 2
s = int(input("Enter seconds: "))
mins = s // 60
secs = s % 60
print(mins, "minutes and", secs, "seconds")
Output

= RESTART:
C:\Users\LENOVO\Desktop\Saharsh\p3.py
Enter value : 5
Enter value : 69
Before swapping a : 5
Before swapping b : 69
After swapping a becomes : 69
After swapping b becomes : 5
#CODE 3
a=int(input("Enter value : "))
b=int(input("Enter value : "))

print("Before swapping a :",a)


print("Before swapping b :",b)
a=a+b
b=a-b
a=a-b

print("After swapping a becomes :",a)


print("After swapping b becomes :",b)
Output
= RESTART: C:\Users\LENOVO\Desktop\Saharsh\p4.py
Input a number: 7
It is a positive number

================ RESTART:
C:\Users\LENOVO\Desktop\Saharsh\p4.py ================
Input a number: -3
It is a negative number

================ RESTART:
C:\Users\LENOVO\Desktop\Saharsh\p4.py ================
Input a number: 0
It is zero
#CODE 4
num = float(input("Input a number: "))
if num > 0:
print("It is a positive number")
elif num == 0:
print("It is zero")
else:
print("It is a negative number")
Output
= RESTART: C:\Users\LENOVO\Desktop\Saharsh\p5.py
water consumed in gallons165
tax is 1125

================ RESTART:
C:\Users\LENOVO\Desktop\Saharsh\p5.py
================
water consumed in gallons38
No tax

================ RESTART:
C:\Users\LENOVO\Desktop\Saharsh\p5.py
================
water consumed in gallons560
tax is 2000
#CODE 5
a=int(input("water consumed in gallons"))
if a<=45:
print("No tax")
elif 45<a<=75:
print("Tax is 475")
elif 75<a<=125:
print("tax is 750")
elif 125<a<=200:
print("tax is 1125")
elif 200<a<=350:
print("tax is 1650")
elif a>350:
print("tax is 2000")
Output
= RESTART: C:\Users\LENOVO\Desktop\Saharsh\p6.py
Enter the digit form 0 to 9 : 7
Entered Digit is : Seven

================ RESTART:
C:\Users\LENOVO\Desktop\Saharsh\p6.py ================
Enter the digit form 0 to 9 : 3
Entered Digit is : Three

================ RESTART:
C:\Users\LENOVO\Desktop\Saharsh\p6.py ================
Enter the digit form 0 to 9 : 9
Entered Digit is : Nine
#CODE 6
n=int(input("Enter the digit form 0 to 9 : "))
print("Entered Digit is : ",end='')
if n==0:
print("Zero")
elif n==1:
print("One")
elif n==2:
print("Two")
elif n==3:
print("Three")
elif n==4:
print("Four")
elif n==5:
print("Five")
elif n==6:
print("Six")
elif n==7:
print("Seven")
elif n==8:
print("Eight")
elif n==9:
print("Nine")
else:
print("Not a Digit")
Output
= RESTART: C:\Users\LENOVO\Desktop\Saharsh\p7.py
Enter any number: 5
5 is a prime number

================ RESTART:
C:\Users\LENOVO\Desktop\Saharsh\p7.py ================
Enter any number: 6
6 is not a prime number

================ RESTART:
C:\Users\LENOVO\Desktop\Saharsh\p7.py ================
Enter any number: 2
2 is a prime number
#CODE 7
number = int(input("Enter any number: "))
if number > 1:
for i in range(2, number):
if (number % i) == 0:
print(number, "is not a prime number")
break
else:
print(number, "is a prime number")
else:
print(number, "is not a prime number")
Output
= RESTART: C:\Users\LENOVO\Desktop\Saharsh\p8.py
Enter the length of series7
0 1 1 2 3 5 8 13 21

================ RESTART: C:\Users\LENOVO\Desktop\Saharsh\p8.py


================
Enter the length of series11
0 1 1 2 3 5 8 13 21 34 55 89 144

================ RESTART: C:\Users\LENOVO\Desktop\Saharsh\p8.py


================
Enter the length of series21
0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765 10946 17711
#CODE 8
a, b = 0, 1
n =int(input(“Enter the length of series”))
print(a, b, end=' ')
for i in range(n):
c=a+b
print(c, end=' ')
a=b
b=c
Output
============== RESTART:
C:\Users\LENOVO\Desktop\Saharsh\p9(a).py
==============
6 7 8 9 10
6789
678
67
6
=============== RESTART:
C:\Users\LENOVO\Desktop\Saharsh\p9(b).py
==============
P
Py
Pyt
Pyth
Pytho
Python
#CODE 9
#part A
for i in range(10,5,-1):
for j in range(6,i+1):
print(j,end=" ")
print()
#part B
word = "Python"

for i in range(1, len(word) + 1):


print(word[:i])
Output
= RESTART: C:\Users\LENOVO\Desktop\Saharsh\p10.py
Enter a string hello world
Frequency of h : 1

Frequency of e : 1

Frequency of l : 3

Frequency of l : 3

Frequency of o : 2

Frequency of : 1

Frequency of w : 1

Frequency of o : 2

Frequency of r : 1

Frequency of l : 3

Frequency of d : 1
#CODE 10
string=str(input("Enter a string"))

for i in string:
frequency = string.count(i)
print("Frequency
of",str(i),":",str(frequency))
print()
Output
= RESTART: C:\Users\LENOVO\Desktop\Saharsh\p11.py
insert list elements[5,6,7,99,124,69,11,56]
sum = 377
average = 47.125
#CODE 11
L=eval(input("insert list elements"))
count = 0
for i in L:
count += i
avg = count/len(L)

print("sum = ", count)


print("average = ", avg)
Output
= RESTART: C:\Users\LENOVO\Desktop\Saharsh\p12.py
Enter the list: [5,9,11,9,4,9,2,69,45]
Modified List:
[5, 9, 11, 4, 2, 69, 45, 9, 9]
#CODE 12
l = eval(input("Enter the list: "))
dedup = []
dup = []
for i in l:
if i in dedup:
dup.append(i)
else:
dedup.append(i)

l = dedup + dup

print("Modified List:")
print(l)
Output

= RESTART: C:\Users\LENOVO\Desktop\Saharsh\p13.py
Enter list: [11,96,69,45,18,7,10]
Enter number to search: 69
69 found at index 2
#CODE 13
l = eval(input("Enter list: "))
n = int(input("Enter number to search: "))

if n in l:
print(n, "found at index", l.index(n))
else :
print(n, "not found in list")
Output
= RESTART: C:\Users\LENOVO\Desktop\Saharsh\p14.py
Enter Tuple:(11,45,18,69)
Second largest value is: 45
#CODE 14
T=eval(input('Enter Tuple:'))
maxvalue=max(T)
length=len(T)
secmax=0
for a in range(length):
if secmax<T[a]<maxvalue:
secmax=T[a]
print('Second largest value is:',secmax
Output
================ RESTART:
C:\Users\LENOVO\Desktop\Saharsh\p15.py ===============
Enter first tuple = (9,16,7,11)
Enter second tuple = (5,4,69,14)
False

================ RESTART:
C:\Users\LENOVO\Desktop\Saharsh\p15.py ===============
Enter first tuple = (9,16,7,11)
Enter second tuple = (9,16,7,11)
True
#CODE 15
tup1 = eval(input("Enter first tuple = "))
tup2 = eval(input("Enter second tuple = "))
count = 0
if len(tup1)==len(tup2):
for i in range(len(tup1)) :
if tup1[i] == tup2 [ i ] :
continue
else :
count += 1
if count == 0 :
print("True")
else :
print("False")
else :
print("False")
Output
= RESTART: C:\Users\LENOVO\Desktop\Saharsh\p16.py
Enter elements of the tuple separated by commas: 2,4,67,8,9
Minimum element lies at middle position: False
#CODE 16
user_input = input("Enter elements of the tuple separated by
commas: "
try:
user_tuple = tuple(map(int, user_input.split(',')))
except ValueError:
print("Please enter valid integers separated by commas.")
exit()
def is_minimum_at_middle(tup):
min_element = min(tup)
# Find the index of the minimum element
min_index = tup.index(min_element)
return min_index == len(tup) // 2
result = is_minimum_at_middle(user_tuple)
print("Minimum element lies at middle position:", result)
Output
================ RESTART:
C:\Users\LENOVO\Desktop\Saharsh\p17.py ===============
Enter a dictionary :- {"ram":2, "shyam":6}
Enter a value :-2
Frequency of occurrence of 2 is 1
Its key are :-
ram
#CODE 17
tup1 = eval(input("Enter first tuple = "))
tup2 = eval(input("Enter second tuple = "))
count = 0
if len(tup1)==len(tup2):
for i in range(len(tup1)) :
if tup1[i] == tup2 [ i ] :
continue
else :
count += 1
if count == 0 :
print("True")
else :
print("False")
else :
print("False")
Output
= RESTART: C:\Users\LENOVO\Desktop\Saharsh\p18.py
How many students ?3
Name of the student:saharsh
Number of competitions won :4
Name of the student:sarthak
Number of competitions won :7
Name of the student:saksham
Number of competitions won :5
The dictipnary now is:
{'saharsh': 4, 'sarthak': 7, 'saksham': 5}
#CODE 18
n=int(input("How many students ?"))
CompWinners={}
for a in range(n):
key= input("Name of the student:")
value=int(input("Number of competitions
won :"))
CompWinners [key]=value
print("The dictipnary now is:")
print(CompWinners)
Output
= RESTART: C:\Users\LENOVO\Desktop\Saharsh\p19.py
Enter the String: hello
{'h': 1, 'e': 1, 'l': 2, 'o': 1}

================ RESTART:
C:\Users\LENOVO\Desktop\Saharsh\p19.py ===============
Enter the String: Aryans
{'a': 2, 'r': 1, 'y': 1, 'n': 1, 's': 1}

================ RESTART:
C:\Users\LENOVO\Desktop\Saharsh\p19.py ===============
Enter the String: School
{'s': 1, 'c': 1, 'h': 1, 'o': 2, 'l': 1}
#CODE 19
n=input("Enter the String: ").lower()
s={}
for i in n:
if i in s:
s[i]+=1
else:
s[i]=1
print(s)
Output
= RESTART: C:\Users\LENOVO\Desktop\Saharsh\p20.py
Enter first dictionary :-{'Germany': 'Berlin', 'Canada': 'Ottawa',
'England': 'London'}
Enter second dictionary :-{'Germany': 'Berlin', 'Canada': 'Ottawa',
'England': 'London', 'India' : 'Delhi' , 'Nepal' : 'Bhutan'}
Then d1 is contained in d2.
#CODE 20
dic1 = eval(input("Enter first dictionary :-"))
dic2 = eval(input("Enter second dictionary :-"))

count = 0
for i in dic1 :
for j in dic2 :
if i == j :
count += 1

if count == len(dic1):
print("Then d1 is contained in d2.")
else :
print("Then d1 is not contained in d2.")

You might also like