0

I want to print all even numbers from given number to end number

Example input 3,11- output : 4,6,8,10,12,14,16,18,20,22 def even_numbers(start,n): for i in range(start,n): if i%2==0: print(i) even_numbers(3,11)

28th Mar 2022, 3:08 PM
Manoj Bhaagam
6 Answers
+ 2
Manoj Bhaagam Hi! Hereā€™s a way to get 11 even numbers from 3: https://code.sololearn.com/cDnUBnzv93Py/?ref=app
28th Mar 2022, 6:01 PM
Per Bratthammar
Per Bratthammar - avatar
+ 1
Mind that in range(start, stop) stop is not inclusive. Your output example doesn't match the task description and the input values, e.g. 20 is not in [3; 11]
28th Mar 2022, 3:18 PM
Lisa
Lisa - avatar
+ 1
Per Bratthammar thank you
29th Mar 2022, 2:17 AM
Manoj Bhaagam
28th Mar 2022, 5:34 PM
Per Bratthammar
Per Bratthammar - avatar
0
Per Bratthammar if I take the input (3,11) I want to print the 11even numbers from 3
28th Mar 2022, 5:40 PM
Manoj Bhaagam
0
You can use this: a = 1 While a <= 20: If a % 2 == 0: Print(a) a = a + 1
30th Mar 2022, 2:09 PM
Okundaye Jesse Eghosasere
Okundaye Jesse Eghosasere - avatar