In: Computer Science
Python
# Write a program that examines three variables—x, y, and z
# and prints the largest odd number among them.
# If none of them are odd, it should print a message to that
effect.
n = input('Enter the 1st Integer x: ')
x = int(n)
n = input('Enter the 2nd Integer y: ')
y = int(n)
n = input('Enter the 3rd Integer z: ')
z = int(n)
if x % 2 == 0 and y % 2 == 0 and z % 2 == 0:
print ("None of them are odd")
if x % 2 == 1 and (x >= y or y % 2 == 0) and (x >= z or z
% 2 == 0):
print (x,'- x is largest')
if y % 2 == 1 and (y >= x or x % 2 == 0) and (y >= z or z
% 2 == 0):
print (y,'- y is largest')
if z % 2 == 1 and (z >= x or x % 2 == 0) and (z >= y or y
% 2 == 0):
print (z,'- z is largest')
(a) Come up with the natural partition and test case for the above
program.
n = input('Enter the 1st Integer x: ')
x = int(n)
n = input('Enter the 2nd Integer y: ')
y = int(n)
n = input('Enter the 3rd Integer z: ')
z = int(n)
if x % 2 == 0 and y % 2 == 0 and z % 2 == 0:
print ("None of them are odd")
if x % 2 == 1 and (x >= y or y % 2 == 0) and (x >= z or z
% 2 == 0):
print (x,'- x is largest')
if y % 2 == 1 and (y >= x or x % 2 == 0) and (y >= z or z
% 2 == 0):
print (y,'- y is largest')
if z % 2 == 1 and (z >= x or x % 2 == 0) and (z >= y or y
% 2 == 0):
print (z,'- z is largest')
beaware of indentation
try to type the code