需要帮助获得 while 循环以处理 python 中的列表

Need help getting a while loop to work with a list in python

我正在制作一个小程序,使用 while 循环将华氏度转换为摄氏度,方法是从列表中获取温度并将其发送到函数进行计算。一旦它将温度从 F 转换为 C,它将打印每个温度的结果。我不想为我编写代码,我只是在寻找一些信息让我朝着正确的方向前进。这是我到目前为止所拥有的,但我认为我不需要其中的 for 循环。 temp 应该是华氏度的每个温度,add 函数应该将其转换为摄氏度。

def add(x):
    return float(x - 32) * 5.0/9.0


temp = [-10, -2, 7, 16, 24, 32, 41, 50, 58, 67, 75]
while True:
    for x in temp:

        print(x)

您不需要 while True 循环。而且您不想打印 temp 中的项目;您想要在 temp.

中的每个项目上打印调用 add() 结果
for x in temp:
    print(add(x))