排序患者姓名和温度的程序中出现语法错误

2024-09-29 19:34:44 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在上我的第一门python课程。我将编写一个程序,要求输入多少名患者,他们的姓名,他们的体温,并对名单进行排序。我需要我的程序列出温度高于98.6的名字,我在98.6之后遇到了语法错误

def getTempOver98_6(count, howMany, temp):
    # Reset count back to 0 to start at the top of the list
    count=0


    # while loop to determine letter grade
    while count < howMany:
        if temp[count] >= 98.6
        print(patientName, temp)
        count = count + 1

#END getTempOver98_6 FUNCTION

Tags: theto程序患者排序count温度temp
2条回答

缩进正确的代码

def getTempOver98_6(count, howMany, temp):
    # Reset count back to 0 to start at the top of the list
    count=0


    # while loop to determine letter grade
    while count < howMany:
        if temp[count] >= 98.6:
            print(patientName, temp)
        count = count + 1

def getTempOver98_6(数量、温度):

# for loop removes the need to use the variable "count" 
# for loop compares all elements.
for count in range(howMany):
    if temp[count] >= 98.6:
        print(patientName, temp)

相关问题 更多 >

    热门问题