0
How to get all the numbers that are divisible by 2 in python?
In a list form or open form
5 Antworten
+ 4
Hello Poorna Sasank
Please show us your attempt so that we can help you.
+ 1
Ok
0
I don't know how to so I asked this question
0
You need a loop and an if statement.
if i % 2 == 0: print(i)
If a number is divisble by 2, print it or put it in a list.
Read the lesson about for loops than you should be able to solve this task :)
0
Enter the numbers for example : 10 or 20 or 30............n
a=int(input("enter number of terms:"))
for i in range(a+1):
if i%2==0:
print(i)