ECE054-Lab2
ECE054-Lab2
ipynb - Colaboratory
2+8/2*3
14.0
(6+3)-8//4*2+3
2+8//2+3
2**(2+3)-4/2*2+2
30.0
5<6<8
account_circle 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="")
name = "Krishna"
age = 21
print("Hello", name, "Your age is", age, end="")
print(" You will be",age+1, "next year")
name = "Krishna"
age = 21
print("Hello", name, "Your age is", age, end="/n")
print(" You will be",age+1, "next year")
name = "Krishna"
age = 21
print("Hello", name, "Your age is", age, )
print(" You will be",age+1, "next year")
x**1/2
8.5
https://colab.research.google.com/drive/1O30QT2xoPmWk4SAHWSsSWvHsONixdEve#printMode=true 1/4
28/10/2023, 14:38 ECE054-Lab2.ipynb - Colaboratory
b= 2
h = 3
print(0.5*b*h**2)
9.0
x = 2
print(x**1/2)
1.0
x = 4
print(x**1/2)
2.0
x = 13
print(x**0.5)
3.605551275463989
a= 3.14
b= int(input("Enter radius "))
c = 2*a*b
print("Circumference =",c)
Enter radius 2
Circumference = 12.56
a= 3.14
b= int(input("Enter radius "))
c = a*b**2
print("Area =",c)
Enter radius 2
Area = 12.56
Enter x1 :1
Enter x2 :1
Enter y1 :1
Enter y2 :1
0.0
b = 5
a = 1
c = 1
-b+((b**2-4*a*c)**0.5)/(2*a)
-2.70871215252208
https://colab.research.google.com/drive/1O30QT2xoPmWk4SAHWSsSWvHsONixdEve#printMode=true 2/4
28/10/2023, 14:38 ECE054-Lab2.ipynb - Colaboratory
If the number 3 is entered by the user when the following code is run, what should be written in the missing part for the output to be 4
Enter a value : 3
4
Write the code that accepts five values from the user and displays the sum of all the five values. For eg: if the user enters 10, 20, 30, 40 and
50 are the values, the output should be 150.
Write the code that accepts five values from the user and displays the concatenated result of all the five values
Write a program to calculate the area of a circle, for a radius given by the user. Give a proper formatted output.
Write a program to calculate the area of an equilateral triangle if the length of a side is given by the user.
https://colab.research.google.com/drive/1O30QT2xoPmWk4SAHWSsSWvHsONixdEve#printMode=true 3/4
28/10/2023, 14:38 ECE054-Lab2.ipynb - Colaboratory
Write a program to read the number of seconds and print it in the form hr:min:sec.
A frog is currently at point 0 on x − axis. It jumps by the following way: It always jumps to the right by a units. Your task is to calculate the
position of the frog after k jumps. Inputs - a and k.
Froggy's jump
Enter how many jumps the frog completed : 2
The position of the frog will be at the 10 th unit on x axis
A frog is currently at point 0 on x − axis. It jumps by the following way: the first jump is a units to the right, the second jump is b units to the
left, the third jump is a units 4 to the right, and the fourth jump is b units to the left, and so on. Your task is to calculate the position of the frog
after k jumps. Inputs - a, b, and k.
https://colab.research.google.com/drive/1O30QT2xoPmWk4SAHWSsSWvHsONixdEve#printMode=true 4/4