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

Labassignment 3 MS

Uploaded by

notrealbybit
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

Labassignment 3 MS

Uploaded by

notrealbybit
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Problem Solving Using Python Lab [ITFC-0131]

Lab Assignment Sheet 3.


Name = Nikhil Yadav
Roll No. = 23124068.
Ques 1.
a=10
b=True
c="hello"
d=12.1
print(type(a))
print(type(b))
print(type(c))
print(type(d))
print(a ,b ,c)

a=float(a)
print(type(a))

name=input("enter your name: ")


print(name)
range(0,5)
for i in range(0,5,2):

ut: print(i)

Ques 2.
a=10
b=12.2
c=1+2j
d=True
print(a)
print(b)
print(c)
print(d)
print(type(a))
print(type(b))
print(type(c))
print(type(d))

list=[1,"s",4.2,True]
print(list)
str="jai shree ram"
print(str)
tuple1=(145,56.33,"ram")
print(tuple1)

set={1,2,11,1,2,3,8}
print(set)

dict={
"key":"value","one":"two","NIT":"Jalandhar"
}
print(dict)

OUTPUT :

Ques 3. A
a=10
b=20
print("before swapping value of a is: ",a)
print("before swapping value of b is: ",b)
c=a
a=b
b=c
print("after swapping value of a is: ",a)
print("after swapping value of b is: ",b)
3. b
a=12
b=23
print("before swapping value of a is: ",a)
print("before swapping value of b is: ",b)
a=a+b
b=a-b
a=a-b
print("After swapping value of a is: ",a)
print("After swapping value of b is: ",b)

Ques 4.
a=int(input("enter the value of a: "))
b=int(input("enter the value of b: "))
print("sum =",a+b)
print("subtraction =",a-b)
print("multiplication =",a*b)
print("division = ",a/b)
print("modular =",a%b)
print("exponential =",a**b)

output:
Ques 5.
a=int(input("enter the value of a: "))
r=int(input("enter the value of r: "))
l=int(input("enter the value of l: "))
b=int(input("enter the value of b: "))
print("Area of square is: ",a*a)
print("Area of reactangle is: ",l*b)
print("Area of circle is : ",3.14*r*r)
output:
Ques 6.
p=int(input("enter the value of p: "))
r=int(input("enter the value of r: "))
t=int(input("enter the value of t: "))
si=p*r*t/100
ci=p*((1+r/100)**t)
print("Simple interest is: ",si)
print("compound interest is:",ci)

output:
Ques 7.
num=int(input("Enter the number: "))
if(num%2==0):
print("Even")
else:
print("Odd")

output:
Ques 8.
num1=int(input("enter number 1: "))
num2=int(input("enter number 2: "))
if(num1>num2):
print(f"{num1} is greater")
else:
print(f"{num2} is greater")

output:
Ques 9.
num=int(input("enter the number: "))
if(num>0):
print("positive number")
elif(num==0):
print("number is zero")
else:
print("negative number")

output:

Ques 10.
def MaximumNo(a,b,c) :
if a >= b and a >=c :
return a
elif b >= a and b>= c :
return b
else :
return c

a = int(input())
b = int(input())
c = int(input())
print("Maximum No. is " , MaximumNo(a,b,c))

OUTPUT :
Ques 11.
n = int(input())

if n > 0 :
print("The number is Positive")

elif n < 0 :
print("The number is Negative")
elif n == 0 :
print("The number is Zero")

else :
print("Non existance ")

OUTPUT :

You might also like