Created
March 1, 2018 17:23
-
-
Save Pierian-Data/5767f49f825dbc9f9bf1357b2152b010 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
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)
print(myfunc("Hello this is Arthi, and I am a student, and I am learning how to work consistently on functions by doing exercises"))
def myfunc(x):
out = []
for word in x.split():
if len(word) % 2 == 0:
out.append(word.lower())
else:
out.append(word.upper())
return ' '.join(out)
print(myfunc("Hello this is Arthi, and I am a student, and I am learning how to work consistently on functions by doing exercises"))
#10.
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)
res1 = myfunc("Sudeep")
print(res1)
res2 = myfunc("Yash")
print(res2)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

def my fun(x):
out = [ ]
for in range(Len(x)):
if I%2==0:
out.append(x([I].upper())
else:
out.append(x[I].lower())
return ".join(out)