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

Final Assignment 1 Python

Python

Uploaded by

rajmaiti00
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)
3 views

Final Assignment 1 Python

Python

Uploaded by

rajmaiti00
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/ 4

IT Workshop Lab (Python)

(PCC-CS393)
CSE – 3rd Sem. – 2nd Year

1. Write a Program in Python to Swap the values of two Variables.


(Using a 3rd Variable & without Using a 3rd Variable).

Program

i.
a=int(input("\n\tEnter the value of a:"))
b=int(input("\n\tEnter the value of b:"))
c=a
a=b
b=c
print("\n\tSwap value of a and b:",a,b)

OUTPUT

i. Enter the value of a:9


Enter the value of b:6
Swap value of a and b: 6 9

Program

ii. a=int(input("\n\tEnter the value of


a:"))
b=int(input("\n\tEnter the value of
b:"))
a,b=b,a
print("\n\tSwap value of a and
b:",a,b)

OUTPUT

ii. Enter the value of a:1


Enter the value of b:2
Swap value of a and b: 2 1

Assignment No. – I Page - 1 SIRSHENDU MAITI,23/CSE/116, </> CSE Dept, FIEM


IT Workshop Lab (Python)
(PCC-CS393)
CSE – 3rd Sem. – 2nd Year

2. Write a Program in Python to Make a Simple Calculator (Taking two Inputs &
calculate their Addition, Subtraction. Multiplication, Division).

Program

a=int(input("\n\tEnter the first number:"))


b=int(input("\n\tEnter the second number:"))
print("\n\tAddition of",a,"and",b,"is=",(a+b))
print("\n\tSubtraction of",a,"and",b,"is=",(a-b))
print("\n\tMultipilcation of",a,"and",b,"is=",(a*b))
print("\n\tDvision of",a,"and",b,"is=",(a/b))

Output

Enter the first number:9

Enter the second number:8

Addition of 9 and 8 is= 17

Subtraction of 9 and 8 is= 1

Multipilcation of 9 and 8 is= 72

Dvision of 9 and 8 is= 1.125

Assignment No. – I Page - 2 SIRSHENDU MAITI,23/CSE/116, </> CSE Dept, FIEM


IT Workshop Lab (Python)
(PCC-CS393)
CSE – 3rd Sem. – 2nd Year

3. Write a Program in Python to find out the Area & Circumference of a Circle.

Program

r=float(input("\n\tEnter the radius:"))


area=3.14*r*r
Curcumference=2*3.14*r
print("\n\tArea and Curcumference:",area,Curcumference)

Output

Enter the radius:77

Area and Curcumference: 18617.06 483.56

Assignment No. – I Page - 3 SIRSHENDU MAITI,23/CSE/116, </> CSE Dept, FIEM


IT Workshop Lab (Python)
(PCC-CS393)
CSE – 3rd Sem. – 2nd Year

4. Write a Program in Python to convert temperature from Fahrenheit to Celsius &


Vice Versa

Program

c=float(input("\n\tEnter the celcius temparature:"))


f=float(input("\n\tEnter thr farenhite temparature:"))
F=(9*c+160)/5
C=(5*f-160)/9
print("\n\tTemparatute celcius to farenhite:",F)
print("\n\tTemparature farehite to celcius:",C)

Output

Enter the celcius temparature:39

Enter thr farenhite temparature:107

Temparatute celcius to farenhite: 102.2

Temparature farehite to celcius: 41.666666666666664

Assignment No. – I Page - 4 SIRSHENDU MAITI,23/CSE/116, </> CSE Dept, FIEM

You might also like