I want to make a program in Python which takes 10 integer values from user and prints the largest odd integer. Plz help.
12 Answers
New AnswerI know to use if, elif, else, while and print and I want to make the program using these commands only.
10/25/2018 8:47:52 AM
Sam Thakkar12 Answers
New AnswerAn alternative with a combination of while loop and if..else blocks loop, i = 0, 1 max_odd = None while loop < 10: n = int(input("Input number #" + str(i) + ": ")) print(n) if n % 2 != 0: if max_odd is None: max_odd = n else: if n > max_odd: max_odd = n loop += 1 i += 1 print(f"\nLargest odd number is {max_odd}")
Firstly you could use a loop to get 10 values from a user and put them into a list: Then divide every number by 2 to find the odd numbers, remove the even numbers from the list. Then do a bunch of comparisons using if statements to find the largest one If you need example code just give me a shout
I havent written the code yet because I couldnt figure out how can i make a program like this. Can you write this one for me as I dont know how to make this program plz?
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message