CSE039 Lab 2A
CSE039 Lab 2A
print(2+8/2*3)
14.0
print(2+8//2**3)
print((6+3)-8//4*2+3)
print(2**(2+3)-4//2*2+2)
30
print(5<6<8)
True
False
x=4
print("ABC"*x)
ABCABCABCABC
print(int(2**3/5))
x,y=7,2
x,y,x=x+1,y+3,x+10
print(x,y)
17 5
name = "Krishna"
age = 21
print("Hello",name,"Your age is:",age,end="")
print("You will be",age+1,"Nextyear")
name = "Krishna"
age = 21
print("Hello",name,"Your age is:",age)
print("You will be",age+1,"Nextyear")
Hello Krishna Your age is: 21
You will be 22 Nextyear
QUESTION 2
perimeter: 6.28
area: 254.34
To find distance
Distance: 4.0
print("finding quadratic eqn")
a=int(input("enter the coefficient of x^2"))
b=int(input("enter the coefficient of x:"))
c=int(input("enter the constant term:"))
x=(b**2-4*a*c)**(1/2)/4*a
print("solutions are:",-b+x,-b-x)
QUESTION 3
output writing
Enter a value: 4
4
Enter a value: 5
Enter a value: 8
58
Enter a value: 3
Enter a value: 4
7
QUESTION 4
Enter a value: 3
QUESTION 5
s=0
for i in range(5):
x=int(input("Enter a no:"))
s+=x
print("Total:",s)
Enter a no: 10
Enter a no: 20
Enter a no: 30
Enter a no: 40
Enter a no: 50
Total: 150
QUESTION 6
s=''
for i in range(5):
x=input("Enter a no:")
s+=x
print(s)
Enter a no: 10
Enter a no: 20
Enter a no: 30
Enter a no: 40
Enter a no: 50
1020304050
QUESTION 7
QUESTION 8
QUESTION 9
print("To find the simple interest")
p=int(input("Enter the principal amount:"))
r=int(input("Enter the rate of interest:"))
t=int(input("enter the time period:"))
print('Simple interest:',(p*r*t)/100)
QUESTION 10
min=0
hour=0
s=int(input("Enter the no of seconds:"))
if s%60==0:
min=s//60
s=0
else:
min=s//60
s=s%60
if min%60==0:
hour=min//60
min=0
else:
hour=min//60
print(hour,":",min,":",s)
1 : 0 : 52
QUESTION 11
QUESTION 12
QUESTION 13