This file contains 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 febo(length): | |
ll = [] | |
if length == 0: | |
return ll | |
if length == 1: | |
ll.append(0) | |
return ll | |
This file contains 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 new_list(list1, list2): | |
list = [] | |
for item1, item2 in zip(list1, list2): | |
list.append(item1) | |
list.append(item2) | |
return list |
This file contains 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 sum(list): | |
if(len(list) == 0): | |
return | |
if(len(list) == 1): | |
return list[0] | |
return sum(list[:-1]) + list[-1] |
This file contains 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 sum(list): | |
m = 0 | |
g = 0 | |
while(g < len(list)): | |
m = m + list[g] | |
g = g + 1 | |
return m |