Answer to Question #289214 in Python for Nearest number

Question #289214

murli is attending a quiz the question contains an integer n murli gas to tell the closest number to n where all the digits of that number are even in case of a tie between two numbers choose the smallest one. write a program to find the number in python coding


1
Expert's answer
2022-01-20T16:16:40-0500
def splitevenodd(A):
    evenlist = []
    oddlist = []
    for i in A:
        if (i % 2 == 0):
            evenlist.append(i)
        else:
            oddlist.append(i)
    print("Even lists:", evenlist)
    print("Odd lists:", oddlist)



A = list()
n = int(input("Enter the n numbers of your list:"))
print("Enter your numbers inside the list:")
for i in range(int(n)):
    k = int(input(""))
    A.append(k)
splitevenodd(A)

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS