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

python

Uploaded by

ganga
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)
5 views

python

Uploaded by

ganga
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
You are on page 1/ 63

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('1.Celcius to fareinheit')

print('2.Fahreinheit 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
EX.NO: 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
EX.NO: 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
EX.NO: 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
EX.NO: 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
EX.NO: 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=[[random.random() 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=[[random.random() 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=[[random.random() 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=[[random.random() 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

EX.NO: 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
EX.NO: 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=color.cyan,opacity=0.25)

from visual import*

sphere(pos=(0,0,0),radius=0.6,color=color.cyan,opacity=0.75,material=materials.rough
)

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=color.yellow,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
EX.NO: 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()

t.left(90)

t.forward(height)

t.write(str(height))

t.right(90)

t.forward(40)

t.right(90)

t.forward(height)

t.left(90)

t.end_fill()

xs=[48,117,200,240,160,260,220]

maxheight=max(xs)

numbers=len(xs)

border=10

wn=turtle.Screen()

wn.setworldcoordinates(0-border,0-border,40*numbers+border,maxheight+border)

wn.bgcolor("lightgreen")

tess=turtle.Turtle()

tess.color("blue")

tess.fillcolor("red")

tess.pensize(3)

for a in xs:

drawBar(tess,a)

wn.exitonclick()

33
OUTPUT:

RESULT:

Thus the above program has been executed successfully.

34
EX.NO: 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=turtle.Screen()

wn.bgcolor('lightblue')

fred=turtle.Turtle()

sc=turtle.Screen()

sc.reset()

sc.setworldcoordinates(0,-1.5,360,1.5)

for angle in range(360):

y=math.sin(math.radians(angle))

fred.goto(angle,y)

wn.exitonclick()

36
OUTPUT:

RESULT:

Thus the above program has been executed successfully.

37
EX.NO: 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=turtle.Screen()

wn.bgcolor('lightblue')

fred=turtle.Turtle()

sc=turtle.Screen()

sc.reset()

sc.setworldcoordinates(0,-1.5,360,1.5)

for angle in range(360):

y=math.cos(math.radians(angle))

fred.goto(angle,y)

wn.exitonclick()

39
OUTPUT:

RESULT:

Thus the above program has been executed successfully.

40
EX.NO:12

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=str.split()

str2=[]

for i in str:

if i not in str2:

str2.append(i)

for i in range(0, len(str2)):

print('frequency of',str2[i],str.count(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
EX.NO:13

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()

window.title("division of 7")

window.geometry('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=a.get()

d=b.get()

for i in range(c,d+1):

if i%7==0:

print(i)

btn = Button(window, text="Click Me", command=clicked)

btn.grid(column=2, row=3)

btn2 = Button(window, text="Exit", command=window.destroy)

btn2.grid(column=2, row=4)

window.mainloop()

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
data.append(tuple(strdata.split(',')))
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:"))
lst.append(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]*math.pow(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 = turtle.Screen()

myPen=turtle.Turtle()

myPen.speed(0)

myPen.shape('turtle')

myPen.width(3)

def drawColumnChart(value1,value2,value3):

global myPen

zoom = 3

myPen.color("#000000")

myPen.penup()

myPen.goto(-30,120)

myPen.write("pulse rate vs height", "None", "center", "20")

myPen.fillcolor("#DB148E")

myPen.goto(-160,-100)

myPen.pendown()

myPen.goto(-160,100)

myPen.penup()

myPen.goto(-160,-100)

myPen.pendown()

myPen.goto(160,-100)

myPen.color("#DB148E")

myPen.penup()

myPen.goto(-120,-100)

myPen.begin_fill()
57
myPen.left(90)

myPen.forward(value1*zoom)

myPen.left(90)

myPen.forward(30)

myPen.left(90)

myPen.forward(value1*zoom)

myPen.left(90)

myPen.forward(30)

myPen.end_fill()

myPen.goto(-130,value1*zoom-100+10)

myPen.write(str(value1)+"cm", "None", "center", "16")

myPen.goto(-100,-100)

myPen.color("#DB148E")

myPen.penup()

myPen.goto(-70,-100)

myPen.begin_fill()

myPen.left(90)

myPen.forward(value2*zoom)

myPen.left(90)

myPen.forward(30)

myPen.left(90)

myPen.forward(value2*zoom)

myPen.left(90)

myPen.forward(30)

myPen.end_fill()

myPen.goto(-90,value2*zoom-100+10)

myPen.write(str(value2)+"cm", "None", "center", "16")

myPen.goto(-100,-100)

myPen.color("#DB148E")

58
myPen.penup()

myPen.goto(-30,-100)

myPen.begin_fill()

myPen.left(90)

myPen.forward(value3*zoom)

myPen.left(90)

myPen.forward(30)

myPen.left(90)

myPen.forward(value3*zoom)

myPen.left(90)

myPen.forward(30)

myPen.end_fill()

myPen.goto(-45,value3*zoom-100+10)

myPen.write(str(value3)+"cm", "None", "center", "16")

myPen.goto(-100,-100)

ANU=43

PRIYA=50

SRI=35

drawColumnChart(ANU,PRIYA,SRI)

screen.tracer(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 re.search("[a-z]",passw):

f1=-1

break

elif not re.search("[A-Z]",passw):

f1=-1

break

elif not re.search("[0-9]",passw):

f1=-1

break

elif not re.search("[_@$]",passw):

f1=-1

break

elif re.search("\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

You might also like