Answer to Question #252568 in Python for Hazer

Question #252568

6. "Even" Now

by CodeChum Admin

I'm really fond of even numbers, you know? That's why I'll be letting you make another even number problem yet again. This time, you need to print from a range of two inputted numbers, n1 and n2 (inclusive), all the even numbers from n2 down to n1, in descending order.

How about that?


Input


1
Expert's answer
2021-10-17T14:00:28-0400
def even(n1, n2):
    list1 = []
    for i in range(n1, n2+1):
        if i % 2 == 0:
            list1.append(i)
    return list1[::-1]
even(2,8)
[8, 6, 4, 2]

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