Write a program that accepts starting value and ending value from the user and generates all
even numbers in this range. Ex: If starting = 34 and ending = 40, output = 34, 36, 38, 40
(in python)
Answers
Answered by
3
def numRange(start,end,step):
for i in range(start,end+step/2,step):
print(i)
if in console or program if you put :
numRange(34,40,2)
it would output all numbers from start to end counting up in step, so in this case:
34
36
38
40
So numRange(20,40,5) ouputs
20
25
30
35
40
Similar questions