Re-read the problem statement - you missed this bit:
If no odd number was entered, it should print a message to that effect.
I'm not sure of your knowledge level, but I'll introduce the idea of a filter, which is the easiest way to select just the odd numbers from the array. Let's write a named function to detect odd numbers:
def is_odd(n):
return n % 2 == 1
Then we can filter our numbers (let's give the list a more meaningful name than A, and use lower-case as that's Python standard):
odd_numbers = filter(is_odd, numbers)
Once we have the odd numbers, we can use the built-in max function, though we need to provide a default value for when no numbers are odd:
return max(odd_numbers, default=None)
We can put these together in a function:
def largest_odd(numbers):
'''
Return the largest odd number in the array,
or None if there are no odd numbers
Examples:
>>> largest_odd([])
>>> largest_odd([0,2])
>>> largest_odd([0,2,1])
1
>>> largest_odd([0,-1,-5])
-1
>>> largest_odd([-5,-1,0])
-1
'''
odd_numbers = filter(is_odd, numbers)
return max(odd_numbers, default=None)
Notice that I've provided a description of what the function does, including examples. The description is called a docstring, and will become more important when you write more complex code. The examples are written in a particular form so they can be automatically tested using this bit of magic (don't worry too much about how it works just now):
if __name__ == '__main__':
import doctest
exit(doctest.testmod()[0] > 0)
To use largest_odd in a program, I suggest this:
numbers = [int(input('Enter the number: ')) for _ in range(10)]
n = largest_odd(numbers)
if n:
print(n)
else:
print("No odd numbers present")
That first line here is a list comprehension that calls input 10 times and creates an array.