Jan-26-2018, 09:18 AM
hello,
one interesting task:
it works in the interactive mode of the interpreter:
thanks in advance!
one interesting task:
>>> gaga(15) [ 1, 2, 'gaga', 4, 'bieber', 'gaga', 7, 8, 'gaga', 'bieber', 11, 'gaga', 13, 14, 'gagabieber' ]until now i have managed to:
def gaga(n): n = list(range(1, n + 1)) s = ['gaga' if cm % 3 == 0 else cm for cm in n] return sdef gaga(n) -> gabi.py
it works in the interactive mode of the interpreter:
>>> import gabi gabi.gaga(15) [1, 2, 'gaga', 4, 5, 'gaga', 7, 8, 'gaga', 10, 11, 'gaga', 13, 14, 'gaga']then i try in some unfolded form:
def gaga(n): n = list(range(1, n + 1)) for cm in n: if cm % 3 == 0: cm % ('gaga') elif cm % 5 == 0: cm % ('gagabieber') print(cm)but it does not work. some ideas?
thanks in advance!