I want to filter out any number that contains a odd digit in it, this should happen in a range of number.

e.g.

1-10 must give an output as follows:

2 4 6 8 Nov 19, 2018 in Python 78 views

2 answers to this question.

This code will work:

scsv = ""
for i in range (1000,3001):
if i % 2 == 0:
if '1' not in str(i) and '3' not in str(i) and '5' not in str(i) and '7' not in str(i) and '9' not in str(i):
scsv = scsv+str(i)+" , "
print (scsv[:-3])

This code is very basic but serves the purpose. answered Nov 19, 2018 by Nabarupa
n = list(range(10))

b = list(filter(lambda i:i%2!=0,n))

print(b) answered Sep 30 by Nomizo_Coders

How to calculate square root of a number in python?

calculate square root in python >>> import math ...READ MORE

How to find exponent of a number in Python?

Yes you can do it using the ...READ MORE

How to print first character of each word in upper case of a string in Python

You can use split() using space as ...READ MORE

How to get the size of a string in Python?

If you are talking about the length ...READ MORE

how can i randomly select items from a list?

if you google it you can find. ...READ MORE

+1 vote

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

how do i use the enumerate function inside a list?

can you give an example using a ...READ MORE

How to set Colorbar Range in matplotlib using Python

You could scale your data to the ...READ MORE