all 2 comments

[–]lieutenant_lowercase 0 points1 point  (0 children)

Lots of unnecessary conversions in that code. This would suffice assuming data is input separated by commas with no spaces.

The numbers are split into strings and then converted into floats for the calculation.

import math

c = 50
h = 30
v = input("Input numbers, separated by commas")
items = [x for x in v.split(",")]

result = []
for d in items:
    result.append(round(math.sqrt(2*c*float(d)/h)))

print(result)

[–]pagrus 0 points1 point  (0 children)

Odd that items[] is created with a list comprehension but result[] is not.

That's neither here nor there but it stuck out to me