Answers for "python even numbers in a list"

8

program to find even numbers in python

m = int(input("Enter number"))
if m % 2 == 0:
    print(m,"is an even number")
else:
    print(m,"is an odd number")
Posted by: Guest on July-24-2020
0

recursive python program to print numbers from n to 1

# Read the input
n = int(input())

def rec(n):
    if n==0:
        print(0)
    else:
        print(-n)
        rec(n-1)
        print(n)

rec(n)
Posted by: Guest on May-09-2020
1

python 3 numbers of a range is even

def check(element):
    return all(ord(i)%2 == 0 for i in element)  # all returns True if all digits i is even in element

lst = [str(i) for i in range(1000,3001)]        # creates list of all given numbers with string data type
lst = list(filter(check,lst))                   # filter removes element from list if check condition fails
print(",".join(lst))
Posted by: Guest on February-10-2020

Code answers related to "python even numbers in a list"

Python Answers by Framework

Browse Popular Code Answers by Language