CSE039 Lab 2
CSE039 Lab 2
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 your name: niya Enter your age: 17 Enter your marks: 90.0 The name is: niya The age is: 17
The marks is: 90.0
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
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
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 12
a=int(input("enter the no of units it jumps right in a single jump:"))
k=int(input("enter the no of jumps:"))
print("the position of the frog is at:",k*a)
QUESTION 13