English, asked by kanjuram, 7 months ago

The even_numbers function returns a space-separated string of all positive numbers that are divisible by 2,
up to and including the maximum that's passed into the function. For example, even_numbers(6) returns “2 4 6”.

Answers

Answered by tanishque000567
0

Answer:

def even_numbers(maximum):

return_string = ""

for x in range(2,maximum+1,2):

return_string += str(x) + " "

return return_string.strip()

print(even_numbers(6))  # Should be 2 4 6

print(even_numbers(10)) # Should be 2 4 6 8 10

print(even_numbers(1))  # No numbers displayed

print(even_numbers(3))  # Should be 2

print(even_numbers(0))  # No numbers displayed

Similar questions