Xi Practical File
Xi Practical File
Xi Practical File
SCIENCE
PROGRAM FILE
INDEX
1
COMPUTER SCIENCE
2
COMPUTER SCIENCE
3
COMPUTER SCIENCE
4
COMPUTER SCIENCE
5
COMPUTER SCIENCE
Sum=a+b
OUTPUT:-
6
COMPUTER SCIENCE
OUTPUT:-
7
COMPUTER SCIENCE
Area=(1/2)*b*h
OUTPUT:-
8
COMPUTER SCIENCE
P=(a+b+c)/3
print('The percentage marks are:', P,'%')
OUTPUT:-
9
COMPUTER SCIENCE
A=a**2
T=((3**0.5)/4)*a**2
OUTPUT:-
10
COMPUTER SCIENCE
SI=(P*R*T)/100
OUTPUT:-
11
COMPUTER SCIENCE
Q=a//b
R=a%b
OUTPUT:-
12
COMPUTER SCIENCE
if a%2==0:
print('The number is even')
else:
print('The number is odd')
OUTPUT:-
13
COMPUTER SCIENCE
OUTPUT:-
14
COMPUTER SCIENCE
OUTPUT:-
15
COMPUTER SCIENCE
print('Rectangle Specifications')
print('Length=',l)
print('Breadth=', b)
print('Area=', area)
OUTPUT:-
16
COMPUTER SCIENCE
OUTPUT:-
17
COMPUTER SCIENCE
OUTPUT:-
18
COMPUTER SCIENCE
19
COMPUTER SCIENCE
Feet=a*0.032
Inch=a*0.393
OUTPUT:-
20
COMPUTER SCIENCE
OUTPUT:-
21
COMPUTER SCIENCE
OUTPUT:-
22
COMPUTER SCIENCE
Area=b*h
Perimeter=2*(b+w)
OUTPUT:-
23
COMPUTER SCIENCE
OUTPUT:-
24
COMPUTER SCIENCE
OUTPUT:-
25
COMPUTER SCIENCE
OUTPUT:-
26
COMPUTER SCIENCE
OUTPUT:-
27
COMPUTER SCIENCE
28
COMPUTER SCIENCE
OUTPUT:-
29
COMPUTER SCIENCE
OUTPUT:-
30
COMPUTER SCIENCE
31
COMPUTER SCIENCE
32
COMPUTER SCIENCE
33
COMPUTER SCIENCE
34
COMPUTER SCIENCE
OUTPUT:-
35
COMPUTER SCIENCE
OUTPUT:-
36
COMPUTER SCIENCE
OUTPUT:-
37
COMPUTER SCIENCE
OUTPUT:-
38
COMPUTER SCIENCE
OUTPUT:-
39
COMPUTER SCIENCE
OUTPUT:-
40
COMPUTER SCIENCE
if angle1+angle2+angle3==180:
print('The angles form a triangle')
else:
print('The angles do not form a triangle')
41
COMPUTER SCIENCE
OUTPUT:-
42
COMPUTER SCIENCE
OUTPUT:-
43
COMPUTER SCIENCE
break
else:
print(mersnum,'\tPrime')
OUTPUT:-
44
COMPUTER SCIENCE
45
COMPUTER SCIENCE
OUTPUT:-
46
COMPUTER SCIENCE
47
COMPUTER SCIENCE
48
COMPUTER SCIENCE
49
COMPUTER SCIENCE
50
COMPUTER SCIENCE
51
COMPUTER SCIENCE
OUTPUT:-
52
COMPUTER SCIENCE
line=input('Enter a line:')
lowercount=uppercount=0
digitcount=alphacount=0
for a in line:
if a.islower():
lowercount+=1
elif a.isupper():
uppercount+=1
elif a.isdigit():
digitcount+=1
if a.isalpha():
alphacount+=1
53
COMPUTER SCIENCE
OUTPUT:-
54
COMPUTER SCIENCE
while True:
pos=line.find(sub,start,end)
if pos!=-1:
count+=1
start=pos+lensub
else:
break
if start>=length:
break
print('No. of occurences of',sub,':',count)
55
COMPUTER SCIENCE
OUTPUT:-
56
COMPUTER SCIENCE
string=input('Enter a string:')
length=len(string)
a=0
end=length
string2=''
while a<length:
if a==0:
string2+=string[0].upper()
a+=1
elif(string[a]==' ' and string[a+1]!=' '):
string2+=string[a]
string2+=string[a+1].upper()
a+=2
elif (string[a]==',' and string[a+1]!=','):
string2+=string[a]
string2+=string[a+1].upper()
a+=2
else:
string2+=string[a]
a+=1
57
COMPUTER SCIENCE
print('Original string:',string)
print('Capitalized words string:',string2)
OUTPUT:-
58
COMPUTER SCIENCE
OUTPUT:-
59
COMPUTER SCIENCE
60
COMPUTER SCIENCE
61
COMPUTER SCIENCE
if sub==domain:
if ledo!=lema:
print('It is valid email id')
else:
print('This is invalid email id- contains just the domain name')
else:
print('This email-d is either not valid or belongs to some
other domain')
OUTPUT:-
62