Jul-17-2019, 02:49 PM
Hi, I have a Python homework question; I am ask to write a program where it asks users to input 10 integers and print out the largest odd number from the user inputs. However, I am restrained to only using "if, else, elif", while loop and mathematical operators (if needed). I am not allow to use for loop and the range function.
Here is my code that I have written up so far. I'm not sure if this is correct or if its the right approach. I tried to compile this code and I get an error message. Can anyone tell me what is wrong with my code? Is my thought process correct for answering this homework question? any help would be greatly appreciated! Thank You!
Here is my code that I have written up so far. I'm not sure if this is correct or if its the right approach. I tried to compile this code and I get an error message. Can anyone tell me what is wrong with my code? Is my thought process correct for answering this homework question? any help would be greatly appreciated! Thank You!
x = 0 TenNumbers = int(input('Enter 10 integers')) while(TenNumbers): if (TenNumbers % 2 = 0): print(int(input('This is a even number, please enter another number'))) else (TenNumbers % 2 != 0 and TenNumbers > x): print('This is the largest odd number')