Problem Description
Write a program that computes the body mass index (BMI) of an individual.
Your program should begin by reading a height and weight from the user. If you read the height in meters and the weight in kilograms then body mass index is computed using this slightly simpler formula:
BMI = weight / height *height
Use round function in the final output valueCODING ARENA
a=float(input())
b=int(input())
c=b/(a*a)
print("The BMI IS",round(c,2))
Test Case 1
Input (stdin)1.69 64
Expected OutputThe BMI IS 22.41
Test Case 2
Input (stdin)1.72 71
Expected OutputThe BMI IS 24.0
This blog is to help for the programmers to learn the programs and not to demotivate any people .Our intention is to make the learners to learn the code easily.
Friday, February 1, 2019
Area of a Room
Problem Description
Write a program that asks the user to enter the width and length of a room.
Once the values have been read, your program should compute and display the area of the room.
The length and the width will be entered as floating point numbers. Include units in your prompt and output message; either feet or meters, depending on which unit you are more comfortable working with.
Formula = length*widthCODING ARENA
a=float(input())
b=float(input())
c=a*b
print("The area of the room is",round(c,2),"square feet")
Test Case 1
Input (stdin)23.44 22.33
Expected OutputThe area of the room is 523.42 square feet
Test Case 2
Input (stdin)18.66 22.45
Expected OutputThe area of the room is 418.92 square feet
Three Idiots
Problem Description
Create a program that reads three integers from the user and displays them in sorted order (from smallest to largest).
Use the min and max functions to find the smallest and largest values.
The middle value can be found by computing the sum of all three values, and then subtracting the minimum value and the maximum value.CODING ARENA
a=[]
for i in range(3):
b=int(input())
a.append(b)
a.sort()
print("The minimum value is",a[0])
print("The maximum value is",a[2])
print("The middle value is",a[1])
Test Case 1
Input (stdin)25 12 1988
Expected OutputThe minimum value is 12 The maximum value is 1988 The middle value is 25
Test Case 2
Input (stdin)9 19 1972
Expected OutputThe minimum value is 9 The maximum value is 1972 The middle value is 19
Convert integer to float
Problem Description
Given an input as integer to the machine , he need to get the output of corresponding floating point number
Hint: Divide the number by 100 and display the output
Please help him to write the program that satisfy the output.CODING ARENA
a=int(input())
b=a/100
print(b)
Test Case 1
Input (stdin)12
Expected Output0.12
Test Case 2
Input (stdin)15
Expected Output0.15
Gravity Fall
Problem Description
Create a program that determines how quickly an object is traveling when it hits the ground. The user will enter the height from which the object is dropped in meters (m).
Because the object is dropped its initial speed is 0m/s. Assume that the acceleration due to gravity is 9.8m/s.
vf =squareroot(vi+2ad)
You can use the formula given above to compute the final speed, vf , when the initial speed, vi , acceleration, a, and distance, d, are knownCODING ARENA
import math
a=int(input())
ans=math.sqrt(2*9.8*a)
print("The object will hit the ground at",round(ans,2),"m/s")
Test Case 1
Input (stdin)45
Expected OutputThe object will hit the ground at 29.7 m/s
Test Case 2
Input (stdin)148
Expected OutputThe object will hit the ground at 53.86 m/s
eLab Petrol Bunk
Problem Description
In the United States, fuel efficiency for vehicles is normally expressed in miles-pergallon (MPG).
In Canada, fuel efficiency is normally expressed in liters-per-hundred kilometers (L/100 km).
Use your research skills to determine how to convert from MPG to L/100 km.
Then create a program that reads a value from the user in American units and displays the equivalent fuel efficiency in Canadian units.
Note:
Formula is --> 282.48 / fuel efficiency in MPG.CODING ARENA
a=int(input())
b=282.48/a
print(round(b,2))
Test Case 1
Input (stdin)24
Expected Output11.77
Test Case 2
Input (stdin)25
Expected Output11.3
Multiplication Table
Problem Description
Write a python program to print the table of a given number
Print the multiplication till 10.CODING ARENA
n=int(input())
for i in range(1,11):
print(n,"x",i,"=",n*i)
Test Case 1
Input (stdin)7
Expected Output7 x 1 = 7 7 x 2 = 14 7 x 3 = 21 7 x 4 = 28 7 x 5 = 35 7 x 6 = 42 7 x 7 = 49 7 x 8 = 56 7 x 9 = 63 7 x 10 = 70
Test Case 2
Input (stdin)17
Expected Output17 x 1 = 17 17 x 2 = 34 17 x 3 = 51 17 x 4 = 68 17 x 5 = 85 17 x 6 = 102 17 x 7 = 119 17 x 8 = 136 17 x 9 = 153 17 x 10 = 170
Subscribe to:
Posts (Atom)