EX.
NO: 01
TEMPERATURE CALCULATION
DATE: 05.12.19
AIM:
Implement a python script to convert Fahrenheit to celcius.
PROCEDURE:
1. Switch the system ON.
2. Open the IDLE python 3.6.
3. File-> new Window.
4. Type the source code in the python shell.
5. Save the program with an extension .py on your directory or a folder.
6. Run the program using the function key F5 or Run-> Run Module.
7. Terminate the program
1
SOURCE CODE:
def fahr(c):
fa=(c*1.8)+32
return fa
def cel(f):
ca=32-(f/1.8)
return ca
def mmenu():
print('\t\t\t TEMPRATURE CALCULATION')
print('\t\t\t **********************')
print('Menu')
print('[Link] to fareinheit')
print('[Link] to celcius')
def main():
mmenu()
n=int(input('Enter your choice(1 or 2)'))
if n==1:
print('\t\t Conversion of celcious to Fahreinheit')
print('\t\t -------------------------------------')
ccc=int(input('Enter the celcious value:'))
fr=fahr(ccc)
print('Fahreinheit value',fr)
anykey=raw_input('press any key')
mmenu()
main()
elif n==2:
print('\t\t Conversion of Fahreinheit to Celcious')
2
print('\t\t -------------------------------------')
ff=int(input('Enter the Fahreinheit value:'))
cc=cel(ff)
print('Celcious value',cc)
anykey=raw_input('press any key')
mmenu()
main()
elif n==3:
exit()
anykey=raw_input('press any key')
mmenu()
main()
else:
print('Choose a valid key')
anykey=raw_input('press any key')
mmenu()
main()
if __name__=='__main__':
main()
3
OUTPUT:
RESULT:
Thus the above program has been executed successfully.
4
[Link]: 02
FACTORIAL OF GIVEN NUMBER
DATE:09.12.19
AIM:
To find the Factorial of a given number using python.
PROCEDURE:
1. Switch the system ON.
2. Open the IDLE python 3.6.
3. File-> new Window.
4. Type the source code in the python shell.
5. Save the program with an extension .py on your directory or a folder.
6. Run the program using the function key F5 or Run-> Run Module.
7. Terminate the program
5
SOURCE CODE:
print('\t\t\t FACTORICAL CALCULATION')
print('\t\t\t ----------------------')
num=int(input('Enter the number:'))
fact=1
for i in range(1,num+1):
fact=fact*i
print('Factorial of:',num,'is',fact)
6
OUTPUT:
RESULT:
Thus the above program has been executed successfully.
7
[Link]: 03
FIBONACCI SERIES
DATE:12.12.19
AIM:
To display the Fibonacci series of given number using python.
PROCEDURE:
1. Switch the system ON.
2. Open the IDLE python 3.6.
3. File-> new Window.
4. Type the source code in the python shell.
5. Save the program with an extension .py on your directory or a folder.
6. Run the program using the function key F5 or Run-> Run Module.
7. Terminate the program
8
SOURCE CODE:
print('\t\t\t FLBONACCI SERIES')
print('\t\t\t ----------------')
n=int(input('Enter the limit:'))
a=-1
b=1
for i in range(n):
c=a+b
print(c)
a=b
b=c
9
OUTPUT:
RESULT:
Thus the above program has been executed successfully.
10
[Link]: 04
AREA AND CIRCUMFERENCE CALCULATION
DATE:16.12.19
AIM:
To find the Area and Circumference calculation of a Rectangle, Square and Circle
using python.
PROCEDURE:
1. Switch the system ON.
2. Open the IDLE python 3.6.
3. File-> new Window.
4. Type the source code in the python shell.
5. Save the program with an extension .py on your directory or a folder.
6. Run the program using the function key F5 or Run-> Run Module.
7. Terminate the program
11
SOURCE CODE:
def square(a):
area=a*a
return area
def csquare(a):
circum=4*a
return circum
def rectangle(l,b):
area=l*b
return area
def crectangle(l,b):
circum=2*(l+b)
return circum
def circle(r):
area=3.14*r*r
return area
def ccircle(r):
circum=2*3.14*r
return circum
def main():
print('\t\t\t AREA AND CIRCUMFERENCE CALCULATION')
print('\t\t\t ----------------------------------')
print('\n\t\t Area and Circumference of Rectangle')
print('\t\t --------------------------------------')
ln=int(input('Enter the value for lenght:'))
br=int(input('Enter the value for breadth:'))
arect=rectangle(ln,br)
print('Area of Rectangle:',arect)
12
crect=crectangle(ln,br)
print('Circumference of Rectangle:',crect)
print('\n\t\t Area and Circumference of Square')
print('\t\t-----------------------------------')
s=int(input('Enter the side for square:'))
asqu=square(s)
print('Area of Square is:',asqu)
csqu=csquare(s)
print('Circumference of Square:',csqu)
print('\n\t\t Area and Circumference of Circle')
print('\t\t------------------------------------')
rad=int(input('Enter the radius for circle:'))
acir=circle(rad)
print('Area of Circle is:',acir)
ccir=ccircle(rad)
print('Circumference of Circle:',ccir)
if __name__=='__main__':
main()
13
OUTPUT:
RESULT:
Thus the above program has been executed successfully.
14
[Link]: 05
STUDENT MARKLIST
DATE:19.12.19
AIM:
Implement the python script to find the student marklist.
PROCEDURE:
1. Switch the system ON.
2. Open the IDLE python 3.6.
3. File-> new Window.
4. Type the source code in the python shell.
5. Save the program with an extension .py on your directory or a folder.
6. Run the program using the function key F5 or Run-> Run Module.
7. Terminate the program
15
SOURCE CODE:
name=raw_input('Enter student name:')
reg=int(input('Enter the Register number:'))
m1=int(input('Enter the Mark of Subject1:'))
m2=int(input('Enter the Mark of Subject2:'))
m3=int(input('Enter the Mark of Subject3:'))
m4=int(input('Enter the Mark of Subject4:'))
m5=int(input('Enter the Mark of Subject5:'))
print('\t\t\t ============================')
print('\t\t\t\t STUDENT MARK LIST')
print('\t\t\t =============================')
print('Student Name:',name)
print('Register number:',reg)
tot=m1+m2+m3+m4+m5
avg=tot/5
print('\n Total:',tot)
print('Percentage:',avg)
if(m1>=90):
print('\n Subject1 Result:PASS Grade:A++')
elif(m1>=80 and m1<90):
print('\n Subject1 Result:PASS Grade:A')
elif(m1>=70 and m1<80):
print('\n Subject1 Result:PASS Grade:B')
elif(m1>60 and m1<70):
print('\n Subject1 Result:PASS Grade:C')
elif(m1>=50 and m1<60):
print('\n Subject1 Result:PASS Grade:D')
16
else:
print('\n Subject1 Result:FAIL Grade:AR')
if(m2>=90):
print('\n Subject2 Result:PASS Grade:A++')
elif(m2>=80 and m2<90):
print('\n Subject2 Result:PASS Grade:A')
elif(m2>=70 and m2<80):
print('\n Subject2 Result:PASS Grade:B')
elif(m2>60 and m2<70):
print('\n Subject2 Result:PASS Grade:C')
elif(m2>=50 and m2<60):
print('\n Subject2 Result:PASS Grade:D')
else:
print('\n Subject2 Result:FAIL Grade:AR')
if(m3>=90):
print('\n Subject3 Result:PASS Grade:A++')
elif(m3>=80 and m3<90):
print('\n Subject3 Result:PASS Grade:A')
elif(m3>=70 and m3<80):
print('\n Subject3 Result:PASS Grade:B')
elif(m3>60 and m3<70):
print('\n Subject3 Result:PASS Grade:C')
elif(m3>=50 and m3<60):
print('\n Subject3 Result:PASS Grade:D')
else:
print('\n Subject3 Result:FAIL Grade:AR')
if(m3>=90):
17
print('\n Subject3 Result:PASS Grade:A++')
elif(m3>=80 and m3<90):
print('\n Subject3 Result:PASS Grade:A')
elif(m3>=70 and m3<80):
print('\n Subject3 Result:PASS Grade:B')
elif(m3>60 and m3<70):
print('\n Subject3 Result:PASS Grade:C')
elif(m3>=50 and m3<60):
print('\n Subject3 Result:PASS Grade:D')
else:
print('\n Subject3 Result:FAIL Grade:AR')
if(m4>=90):
print('\n Subject4 Result:PASS Grade:A++')
elif(m4>=80 and m4<90):
print('\n Subject4 Result:PASS Grade:A')
elif(m4>=70 and m4<80):
print('\n Subject4 Result:PASS Grade:B')
elif(m4>60 and m4<70):
print('\n Subject4 Result:PASS Grade:C')
elif(m4>=50 and m4<60):
print('\n Subject4 Result:PASS Grade:D')
else:
print('\n Subject4 Result:FAIL Grade:AR')
if(m5>=90):
print('\n Subject5 Result:PASS Grade:A++')
elif(m5>=80 and m5<90):
print('\n Subject5 Result:PASS Grade:A')
18
elif(m5>=70 and m5<80):
print('\n Subject5 Result:PASS Grade:B')
elif(m5>60 and m5<70):
print('\n Subject5 Result:PASS Grade:C')
elif(m5>=50 and m5<60):
print('\n Subject5 Result:PASS Grade:D')
else:
print('\n Subject5 Result:FAIL Grade:AR')
if(avg>=90):
print('\n Grade:A++')
if(m1>=50 and m2>=50 and m3>=50 and m4>=50 and m5>=50):
print('Result:PASS')
else:
print('Result:FAIL')
elif(avg>=80 and avg<90):
print('\n Grade:A')
if(m1>=50 and m2>=50 and m3>=50 and m4>=50 and m5>=50):
print('Result:PASS')
else:
print('Result:FAIL')
elif(avg>=70 and avg<80):
print('\n Grade:B')
if(m1>=50 and m2>=50 and m3>=50 and m4>=50 and m5>=50):
print('Result:PASS')
else:
print('Result:FAIL')
elif(avg>=60 and avg<70):
19
print('\n Grade:C')
if(m1>=50 and m2>=50 and m3>=50 and m4>=50 and m5>=50):
print('Result:PASS')
else:
print('Result:FAIL')
elif(avg>=50 and avg<60):
print('\n Grade:D')
if(m1>=50 and m2>=50 and m3>=50 and m4>=50 and m5>=50):
print('Result:PASS')
else:
print('Result:FAIL')
else:
print('\n Grade:AR')
if(m1>=50 and m2>=50 and m3>=50 and m4>=50 and m5>=50):
print('Result:PASS')
else:
print('Result:FAIL')
20
OUTPUT:
RESULT:
Thus the above program has been executed successfully.
21
[Link]: 06
MATRIX ADDITION&MULTIPLICATION
DATE:23.01.20
AIM:
Implement a python script to find the sum & product of two matrices.
PROCEDURE:
1. Switch the system ON.
2. Open the IDLE python 3.6.
3. File-> new Window.
4. Type the source code in the python shell.
5. Save the program with an extension .py on your directory or a folder.
6. Run the program using the function key F5 or Run-> Run Module.
7. Terminate the program
22
SOURCE CODE:
import random
print('\t\t Multiplication of Two Matrix')
print('\t\t ****************************')
r1=input('Enter the rows for first matrix:')
c1=input('Enter the column forfirst matrix:')
a=[[[Link]() for col in range(c1)] for row in range(r1)]
for i in range(r1):
for j in range(c1):
a[i][j]=input()
r2=input('Enter the rows for second matrix:')
c2=input('Enter the column for second matrix:')
b=[[[Link]() for col in range(c2)] for row in range(r2)]
for i in range(r2):
for j in range(c2):
b[i][j]=input()
print('\n First Matrix')
print('\n ************')
for i in range(r1):
for j in range(c1):
print a[i][j],'\t',
print
print('\n Second Matrix')
print('\n *************')
for i in range(r2):
for j in range(c2):
23
print b[i][j],'\t',
print
print('\n Matrix Addition')
print('\n ***************')
c=[[[Link]() for col in range(c2)] for row in range(r1)]
if(c1==r2):
for i in range(r1):
for j in range(c2):
c[i][j]=0
c[i][j]=a[i][j]+b[i][j]
print c[i][j],'\t',
print
else:
print('Matrix Addition is not possible')
print('\n Matrix Multiplication')
print('\n *********************')
c=[[[Link]() for col in range(c2)] for row in range(r1)]
if(c1==r2):
for i in range(r1):
for j in range(c2):
c[i][j]=0
for k in range(c1):
c[i][j]=a[i][k]*b[k][j]
print c[i][j],'\t',
print
else:
print('Matrix multiplication is not possible')
24
OUTPUT:
RESULT:
The above program has been executed successfully
[Link]: 07
25
SUM OF SERIES
DATE:27.01.20
AIM:
Implement a python script to find the sum of series.
PROCEDURE:
1. Switch the system ON.
2. Open the IDLE python 3.6.
3. File-> new Window.
4. Type the source code in the python shell.
5. Save the program with an extension .py on your directory or a folder.
6. Run the program using the function key F5 or Run-> Run Module.
7. Terminate the program
SOURCE CODE:
26
def sum(n):
res=0
fact=1
for i in range(1,n+1):
fact=fact*i
res=res+(i/fact)
float(res)
return res
n=int(input('Enter the Limit:'))
print('Sum of Series is:',float(sum(n)))
OUTPUT:
27
RESULT:
Thus the above program has been executed successfully.
28
[Link]: 08
3-D SHAPES
DATE:03.02.20
AIM:
To implement a python script to draw 3D shapes.
PROCEDURE:
1. Switch the system ON.
2. Open the IDLE python 3.6.
3. File-> new Window.
4. Type the source code in the python shell.
5. Save the program with an extension .py on your directory or a folder.
6. Run the program using the function key F5 or Run-> Run Module.
7. Terminate the program
29
SOURCE CODE:
from visual import*
box(size=(7,4,5),color=[Link],opacity=0.25)
from visual import*
sphere(pos=(0,0,0),radius=0.6,color=[Link],opacity=0.75,material=[Link]
)
from visual import*
ring(axis=(0.5,0,0.9),radius=0.5,thickness=0.15)
from visual import*
cylinder(pos=(-2,2,1),axis=(5,0,5),radius=2)
from visual import*
arrow(pos=(-3,0,0),axis=(5,2,0),shaftwidht=0.5,color=[Link],up=(0,10,20))
from visual import*
cone(pos=(0,-2,0),axis=(0,4,0),radius=2)
30
OUTPUT:
RESULT:
Thus the above program has been executed successfully.
31
[Link]: 09
HISTOGRAM
DATE:06.02.20
AIM:
To implement a python script to display the integers as histogram.
PROCEDURE:
1. Switch the system ON.
2. Open the IDLE python 3.6.
3. File-> new Window.
4. Type the source code in the python shell.
5. Save the program with an extension .py on your directory or a folder.
6. Run the program using the function key F5 or Run-> Run Module.
7. Terminate the program
32
SOURCE CODE:
import turtle
def drawBar(t,height): """Get turtle t to draw one bar,of height."""
t.begin_fill()
[Link](90)
[Link](height)
[Link](str(height))
[Link](90)
[Link](40)
[Link](90)
[Link](height)
[Link](90)
t.end_fill()
xs=[48,117,200,240,160,260,220]
maxheight=max(xs)
numbers=len(xs)
border=10
wn=[Link]()
[Link](0-border,0-border,40*numbers+border,maxheight+border)
[Link]("lightgreen")
tess=[Link]()
[Link]("blue")
[Link]("red")
[Link](3)
for a in xs:
drawBar(tess,a)
[Link]()
33
OUTPUT:
RESULT:
Thus the above program has been executed successfully.
34
[Link]: 10
SINE CURVE
DATE:10.02.20
AIM:
To implement a python script to display the sin curve.
PROCEDURE:
1. Switch the system ON.
2. Open the IDLE python 3.6.
3. File-> new Window.
4. Type the source code in the python shell.
5. Save the program with an extension .py on your directory or a folder.
6. Run the program using the function key F5 or Run-> Run Module.
7. Terminate the program
35
SOURCE CODE:
import math
import turtle
wn=[Link]()
[Link]('lightblue')
fred=[Link]()
sc=[Link]()
[Link]()
[Link](0,-1.5,360,1.5)
for angle in range(360):
y=[Link]([Link](angle))
[Link](angle,y)
[Link]()
36
OUTPUT:
RESULT:
Thus the above program has been executed successfully.
37
[Link]: 11
COSINE CURVE
DATE:13.02.20
AIM:
To implement a python script to display the cosine curve.
PROCEDURE:
1. Switch the system ON.
2. Open the IDLE python 3.6.
3. File-> new Window.
4. Type the source code in the python shell.
5. Save the program with an extension .py on your directory or a folder.
6. Run the program using the function key F5 or Run-> Run Module.
7. Terminate the program
38
SOURCE CODE:
import math
import turtle
wn=[Link]()
[Link]('lightblue')
fred=[Link]()
sc=[Link]()
[Link]()
[Link](0,-1.5,360,1.5)
for angle in range(360):
y=[Link]([Link](angle))
[Link](angle,y)
[Link]()
39
OUTPUT:
RESULT:
Thus the above program has been executed successfully.
40
[Link]
FREQUENCY
DATE:17.02.20
AIM:
A python program to compute the frequency of the words from the input.
PROCEDURE:
1. Switch the system ON.
2. Open the IDLE python 3.6.
3. File-> new Window.
4. Type the source code in the python shell.
5. Save the program with an extension .py on your directory or a folder.
6. Run the program using the function key F5 or Run-> Run Module.
7. Terminate the program
41
SOURCE CODE:
def freq(str):
str=[Link]()
str2=[]
for i in str:
if i not in str2:
[Link](i)
for i in range(0, len(str2)):
print('frequency of',str2[i],[Link](str2[i]))
def main():
str='apple mango apple orange orange apple guava mango mango'
freq(str)
if __name__=="__main__":
main()
42
OUTPUT:
RESULT:
Thus the above program has been executed successfully.
43
[Link]
DIVISIOR BY 7
DATE:24.02.20
AIM:
Implement a python script to find the iteration of the numbers that are divisible
by 7.
PROCEDURE:
1. Switch the system ON.
2. Open the IDLE python 3.6.
3. File-> new Window.
4. Type the source code in the python shell.
5. Save the program with an extension .py on your directory or a folder.
6. Run the program using the function key F5 or Run-> Run Module.
7. Terminate the program
44
SOURCE CODE:
from Tkinter import *
window = Tk()
[Link]("division of 7")
[Link]('350x200')
a=IntVar()
b=IntVar()
lbl = Label(window, text="lower limit").grid(column=0, row=0)
txt = Entry(window,textvariable=a,width=10).grid(column=1, row=0)
lb = Label(window, text="upper limit").grid(column=0, row=1)
tx = Entry(window,textvariable=b,width=10).grid(column=1, row=1)
def clicked():
c=[Link]()
d=[Link]()
for i in range(c,d+1):
if i%7==0:
print(i)
btn = Button(window, text="Click Me", command=clicked)
[Link](column=2, row=3)
btn2 = Button(window, text="Exit", command=[Link])
[Link](column=2, row=4)
[Link]()
45
OUTPUT:
RESULT:
Thus the above program has been executed successfully.
46
EX:NO:14
ASCENDING ORDER
DATE:27.02.20
AIM:
A python program to sort the tuples by ascending order.
PROCEDURE:
1. Switch the system ON.
2. Open the IDLE python 3.6.
3. File-> new Window.
4. Type the source code in the python shell.
5. Save the program with an extension .py on your directory or a folder.
6. Run the program using the function key F5 or Run-> Run Module.
7. Terminate the program
47
SOURCE CODE:
from operator import itemgetter,attrgetter
data=[]
print('\t\t\tSort The Tuple By Ascending Order')
print('\t\t\t~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~')
print('Name,Age,Height')
while True:
strdata=raw_input()
if not strdata:
break
[Link](tuple([Link](',')))
print(sorted(data,key=itemgetter(0,1,2)))
48
OUTPUT:
RESULT:
Thus the above program has been executed successfully.
49
EX:NO:15
POLYNOMIAL
DATE:02.03.20
AIM:
Python program to find the value of the polynomial .
PROCEDURE:
1. Switch the system ON.
2. Open the IDLE python 3.6.
3. File-> new Window.
4. Type the source code in the python shell.
5. Save the program with an extension .py on your directory or a folder.
6. Run the program using the function key F5 or Run-> Run Module.
7. Terminate the program
50
SOURCE CODE
import math
print("Enter the coefficients of the form")
lst=[]
for i in range(0,4):
a=int(input("Enter coefficients:"))
[Link](a)
x=int(input("Enter the value of x:"))
sum1=0
j=3
for i in range(0,3):
while(j>0):
sum1=sum1+(lst[i]*[Link](x,j))
break
j=j-1
sum1=sum1+lst[3]
print("The value of polynomial is:",sum1)
51
OUTPUT
RESULT:
Thus the above program has been executed successfully.
52
EX:NO:16
VELOCITY
DATE:05.03.20
AIM:
Python program to calculate the value of the velocity .
PROCEDURE:
1. Switch the system ON.
2. Open the IDLE python 3.6.
3. File-> new Window.
4. Type the source code in the python shell.
5. Save the program with an extension .py on your directory or a folder.
6. Run the program using the function key F5 or Run-> Run Module.
7. Terminate the program
53
SOURCE CODE
def cal_speed(dist,time):
print("Distance(km):", dist);
print("Time(hr):", time);
return dist / time;
def cal_dis(speed, time):
print("Time(hr):", time);
print("speed(km/hr):", speed);
return speed * time;
def cal_time(dist, speed):
print("Distance(km):", dist);
print("speed(km/hr):", speed);
return speed * dist;
print("CALCUTATE TIME,SPEED AND DISTANCE");
print("**********************************");
print("The calculated speed(km/hr) is:", cal_speed(45.9, 2.0));
print("");
print("The calculated distance(km) is:", cal_dis(62.9, 2.5));
print("");
print("The calculated time(hr) is:", cal_time(48.0, 4.5));
54
OUTPUT
RESULT:
Thus the above program has been executed successfully.
55
EX:NO:17
PULSE RATE VS HEIGHT
DATE:09.03.20
AIM:
Python program to calculate the value of the pulse rate vs height.
PROCEDURE:
1. Switch the system ON.
2. Open the IDLE python 3.6.
3. File-> new Window.
4. Type the source code in the python shell.
5. Save the program with an extension .py on your directory or a folder.
6. Run the program using the function key F5 or Run-> Run Module.
7. Terminate the program
56
SOURCE CODE
import turtle
screen = [Link]()
myPen=[Link]()
[Link](0)
[Link]('turtle')
[Link](3)
def drawColumnChart(value1,value2,value3):
global myPen
zoom = 3
[Link]("#000000")
[Link]()
[Link](-30,120)
[Link]("pulse rate vs height", "None", "center", "20")
[Link]("#DB148E")
[Link](-160,-100)
[Link]()
[Link](-160,100)
[Link]()
[Link](-160,-100)
[Link]()
[Link](160,-100)
[Link]("#DB148E")
[Link]()
[Link](-120,-100)
myPen.begin_fill()
57
[Link](90)
[Link](value1*zoom)
[Link](90)
[Link](30)
[Link](90)
[Link](value1*zoom)
[Link](90)
[Link](30)
myPen.end_fill()
[Link](-130,value1*zoom-100+10)
[Link](str(value1)+"cm", "None", "center", "16")
[Link](-100,-100)
[Link]("#DB148E")
[Link]()
[Link](-70,-100)
myPen.begin_fill()
[Link](90)
[Link](value2*zoom)
[Link](90)
[Link](30)
[Link](90)
[Link](value2*zoom)
[Link](90)
[Link](30)
myPen.end_fill()
[Link](-90,value2*zoom-100+10)
[Link](str(value2)+"cm", "None", "center", "16")
[Link](-100,-100)
[Link]("#DB148E")
58
[Link]()
[Link](-30,-100)
myPen.begin_fill()
[Link](90)
[Link](value3*zoom)
[Link](90)
[Link](30)
[Link](90)
[Link](value3*zoom)
[Link](90)
[Link](30)
myPen.end_fill()
[Link](-45,value3*zoom-100+10)
[Link](str(value3)+"cm", "None", "center", "16")
[Link](-100,-100)
ANU=43
PRIYA=50
SRI=35
drawColumnChart(ANU,PRIYA,SRI)
[Link](0)
OUTPUT
59
RESULT:
Thus the above program has been executed successfully.
EX:NO:18
60
PASSWORD
DATE:12.03.20
AIM:
Python program to check username and password .
PROCEDURE:
1. Switch the system ON.
2. Open the IDLE python 3.6.
3. File-> new Window.
4. Type the source code in the python shell.
5. Save the program with an extension .py on your directory or a folder.
6. Run the program using the function key F5 or Run-> Run Module.
7. Terminate the program
SOURCE CODE:
61
import re
passw=raw_input("enter password:")
f1=0
while True:
if(len(passw)<6):
f1=-1
break
elif not [Link]("[a-z]",passw):
f1=-1
break
elif not [Link]("[A-Z]",passw):
f1=-1
break
elif not [Link]("[0-9]",passw):
f1=-1
break
elif not [Link]("[_@$]",passw):
f1=-1
break
elif [Link]("\s",passw):
f1=-1
break
else:
f1=0
print("this is valid password")
break
if f1==-1:
print("not a valid password")
OUTPUT
62
RESULT:
Thus the above program has been executed successfully.
63