Skip to content

Instantly share code, notes, and snippets.

@Pierian-Data
Created March 1, 2018 17:19
Show Gist options
  • Select an option

  • Save Pierian-Data/dd645bb5881653b73015f5956e613243 to your computer and use it in GitHub Desktop.

Select an option

Save Pierian-Data/dd645bb5881653b73015f5956e613243 to your computer and use it in GitHub Desktop.
def myfunc(*args):
out = []
for num in args:
if num%2==0:
out.append(num)
return out
@Girbilio
Copy link

Girbilio commented Feb 5, 2026

def myfunc(word):
mystring=[x for x in word]
result=[]
for i,letter in enumerate(mystring):
if i%2==0:
result.append(letter.lower())
else:
result.append(letter.upper())

return ''.join(result)

@Akashmahaur
Copy link

Akashmahaur commented Feb 26, 2026

def myfunc(*args):
even_number = []
for num in args:
if num % 2 ==0:
even_number.append(num)
return even_number

@Christine-vert
Copy link

Screenshot 2026-03-11 at 3 31 45 pm

@Uche-James
Copy link

def myfunc(*args):
return [ arg for arg in args if arg%2==0]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment