File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change
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
You can’t perform that action at this time.
0 commit comments