-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpythonlistchallenges.py
More file actions
58 lines (39 loc) · 1.15 KB
/
Copy pathpythonlistchallenges.py
File metadata and controls
58 lines (39 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Write your function here
def append_size(my_list):
x = len(my_list)
print(x)
my_list.append(x)
return my_list
# Uncomment the line below when your function is done
print(append_size([23, 42, 108]))
# Write your function here
def append_sum(my_list):
for x in range(3):
x = my_list[-1] + my_list[-2]
my_list.append(x)
return my_list
# Uncomment the line below when your function is done
print(append_sum([1, 1, 2]))
# Write your function here
def larger_list(my_list1, my_list2):
if len(my_list1) >= len(my_list2):
return my_list1[-1]
else:
return my_list2[-1]
# Uncomment the line below when your function is done
print(larger_list([4, 10, 2, 5], [-10, 2, 5, 10]))
# Write your function here
def more_than_n(my_list, item, n):
if my_list.count(item) > n:
return True
else:
return False
# Uncomment the line below when your function is done
print(more_than_n([2, 4, 6, 2, 3, 2, 1, 2], 2, 3))
# Write your function here
def combine_sort(my_list1, my_list2):
y = my_list1 + my_list2
x = sorted(y)
return x
# Uncomment the line below when your function is done
print(combine_sort([4, 10, 2, 5], [-10, 2, 5, 10]))