One Python exercise, please give me some guidance?

write a physical program that requires 10 integers in the book, and then enter the largest odd number. If the user does not enter an odd number, a message is output to explain it.
1, first think of a way to input the number
2, trying to output a number
3, trying to determine whether this number is an odd
decomposition step, you first complete the first step, you can input one by one, or enter

in an array, but I don"t know how to write it. My mind is blank and I can"t figure out how to write it.

Mar.10,2021

first write out the largest number in bubble sort, and then judge whether it is odd (remainder)


def get_max_odd():
    max_odd = None
    num_list = []
    for i in xrange(10):
        while 1:
            try:
                num = input('Input No.%d: ' % (i+1))
                if not isinstance(num, int):
                    print('Must be Int')
                    continue
            except:
                print('Must be Int')
                continue
            num_list.append(str(num))
            if num % 2 == 1:
                if max_odd is None or num > max_odd:
                    max_odd = num
            break
    print('Input Num List: %s' % ', '.join(num_list))
    if max_odd is None:
        print('No Odd!!!')
    else:
        print('Max Odd: %d' % max_odd)


if __name__ == '__main__':
    get_max_odd()

is for reference only. It is suggested that you should follow your own way of thinking.

Menu