Could anyone help me to understand why if I didn't put break
there, the code give me multiple output. For example:
In : myfunc('abogoboga')
Out : 'aBoGoBoGaaBoGoBoGaaBoGoBoGaaBoGoBoGaaBoGoBoGaaBoGoBoGaaBoGoBoGaaBoGoBoGaaBoGoBoGa'
def myfunc(*args):
output = []
for strg in args:
for char in strg:
for i in range(len(strg)):
if i % 2 == 0:
output.append(strg[i].lower())
else:
output.append(strg[i].upper())
break
return ''.join(output)
but, after putting break
as above:
In : myfunc('abogoboga')
Out : 'aBoGoBoGa'