Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Question 7
- def unique_list(l):
- x = []
- for a in l:
- if a not in x:
- x.append(a)
- return x
- print(unique_list([1,2,3,3,3,3,4,5]))
- # Question 8
- my_list = [5, 3, 7, 9, 2, 5, 5, 3, 10, 8, 7]
- print('The list is {0}'.format(my_list))
- def backways(alist):
- return alist[::-1]
- print(backways(my_list)
- # Question 9
- my_list = [5, 3, 7, 9, 2, 5, 5, 3, 10, 8, 7]
- print('The list is {0}'.format(my_list))
- def sum_list(alist):
- total = 0
- for i in range(len(alist)):
- total += alist[i]
- return total
- print(sum_list(my_list))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement