如何避免python循环中的最后一个逗号

Ama*_*man 0 python python-3.x

我想以逗号分隔的形式打印结果输出,但我在最后一个值中得到一个逗号,所以我怎么能删除它.

import math

    d = input().split(',')
    d = [int(i) for i in d]
    c=50
    h=30
    result=[]
    for i in d:
        q=int(round(math.sqrt((2*c*i)/h)))
        result.append(q)
    for i in result:
        print(i, end=",")
Run Code Online (Sandbox Code Playgroud)

这是一个输入的例子我给予和输出我得到

input : 10,20,30,40
output : 6,8,10,12,
Run Code Online (Sandbox Code Playgroud)

我怎么能避免得到最后一个逗号

wim*_*wim 9

将结果作为单独的参数传递并指定分隔符:

 print(*result, sep=',')
Run Code Online (Sandbox Code Playgroud)