Skip to content

Solution for # 12 #161

@bfarber2011

Description

@bfarber2011

Thought I'd share:
Before I discovered all():
li = []
for i in range(1000, 3001):
temp = []
for j in str(i):
if int(j) % 2 == 0:
temp.append(str(j))
val = ''.join(temp)
if len(str(i)) == len(val):
li.append(val)

print(','.join(li))

After I discovered all():
li = []
for i in range(1000, 3001):
if all(int(j) % 2 == 0 for j in str(i)):
li.append(str(i))

print(','.join(li))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions