find the maximum number in a list using a loop

后端 未结 10 1531
野趣味
野趣味 2021-01-02 23:16

So I have this list and variables:

nums = [14, 8, 9, 16, 3, 11, 5]

big = nums[0]

spot = 0

I\'m confused on how to actually do it. Please

10条回答
  •  执笔经年
    2021-01-03 00:02

    For the Max in List Code HS I've managed to get most of the auto grader to work for me using this code:

    list = [-3,-8,-2,0]
    
    current_max_number = list[0]
    for number in list:
        if number>current_max_number:
            current_max_number = number
    
    print current_max_number
    
    def max_int_in_list():
        print "Here"
    

    I'm not sure where the max_int_in_list goes though. It needs to have exactly 1 parameter.

提交回复
热议问题