Skip to main content
deleted 53 characters in body
Source Link

I've been trying to solve same problem with python and I think I've figured out a way that covers all the cases that are possible given the mathematical definition of an odd number. I've tested it and it works, I wonder what do you think.

counter = 0
odd = []
even = []

while counter < 10:
  x = int(input("Enter a number: "))
    if abs(x)%2 == 0 and x != 0:
    even.append(x)
  else:
    odd.append(x)
  counter += 1

 if len(odd) == 0:
   print("No odd number was entered")
 else:
   print("The largest odd number is:", max(odd))

I've been trying to solve same problem with python and I think I've figured out a way that covers all the cases that are possible given the mathematical definition of an odd number. I've tested it and it works, I wonder what do you think.

counter = 0
odd = []
even = []

while counter < 10:
  x = int(input("Enter a number: "))
  if abs(x)%2 == 0 and x != 0:
    even.append(x)
  else:
    odd.append(x)
  counter += 1

if len(odd) == 0:
  print("No odd number was entered")
else:
  print("The largest odd number is:", max(odd))

I've been trying to solve same problem with python and I think I've figured out a way that covers all the cases that are possible given the mathematical definition of an odd number. I've tested it and it works, I wonder what do you think.

counter = 0
odd = []

while counter < 10:
  x = int(input("Enter a number: "))
    if abs(x)%2 != 0:
      odd.append(x)
  counter += 1

 if len(odd) == 0:
   print("No odd number was entered")
 else:
   print("The largest odd number is:", max(odd))
Source Link

I've been trying to solve same problem with python and I think I've figured out a way that covers all the cases that are possible given the mathematical definition of an odd number. I've tested it and it works, I wonder what do you think.

counter = 0
odd = []
even = []

while counter < 10:
  x = int(input("Enter a number: "))
  if abs(x)%2 == 0 and x != 0:
    even.append(x)
  else:
    odd.append(x)
  counter += 1

if len(odd) == 0:
  print("No odd number was entered")
else:
  print("The largest odd number is:", max(odd))