Ask user to input 10 integers and then print the largest odd number that was entered. If no odd number was entered, print a message to that effect.
The above exercise is from chapter 2 of Computation and Programming Using Python by John Guttag. So far, the book has covered variable assignment, print function, conditional branching, and loops. The book is about problem solving and uses Python only as a tool to solve problems and it is meant to be used with Python 2.x. I need to know if my solution to the exercise can be "straightened up" in any way.
numbers_entered =  for _ in range(10): number = raw_input('Enter an integer: ') if number.isdigit(): number = int(number) numbers_entered.append(number) else: print 'That was not an integer!' odd_numbers =  for item in numbers_entered: if item % 2 != 0: odd_numbers.append(item) if odd_numbers: print 'The largest odd number entered was %s.' % str(max( odd_numbers)) else: print 'No odd number was entered.'