Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

Save Pierian-Data/5767f49f825dbc9f9bf1357b2152b010 to your computer and use it in GitHub Desktop.
def myfunc(x):
out = []
for i in range(len(x)):
if i%2==0:
out.append(x[i].lower())
else:
out.append(x[i].upper())
return ''.join(out)
@Bjorn-Suerink
Copy link

Bjorn-Suerink commented Nov 6, 2025

def myfunc(s):
num=0
word=''
for letter in s:
if num%2 == 0:
word += letter.lower()
else:
word+= letter.upper()
num+=1
return word
image

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