Skip to content

Commit bc26be3

Browse files
committed
Worked on Q006, not complete
1 parent 81a20d3 commit bc26be3

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

Q006.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Question 006
2+
3+
#Question:
4+
#Write a program that calculates and prints the value according to the given formula:
5+
#Q = Square root of [(2 * C * D)/H]
6+
#Following are the fixed values of C and H:
7+
#C is 50. H is 30.
8+
#D is the variable whose values should be input to your program in a comma-separated sequence.
9+
#Example
10+
#Let us assume the following comma separated input sequence is given to the program:
11+
#100,150,180
12+
#The output of the program should be:
13+
#18,22,24
14+
15+
# Import the math library
16+
import math
17+
18+
# Equation: Q = ((2 * C * D)/H) ^ (0.5)
19+
# Constants
20+
c = 50
21+
h = 30
22+
23+
inputString = raw_input()
24+
inputList = [value for value in inputString.split(',')]
25+
outputValues = []
26+
27+
for position in inputList:
28+
outputValues = ((2 * c * position)/h) ** 0.5
29+
30+
print outputValues

0 commit comments

Comments
 (0)