-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlists.py
More file actions
47 lines (40 loc) · 971 Bytes
/
Copy pathlists.py
File metadata and controls
47 lines (40 loc) · 971 Bytes
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
def sum(list):
sum = 0
for number in list:
sum = sum + number
return sum
# Takes in a list of numbers, & returns the biggest number
def biggest(list):
biggest_so_far = 0
for num in list:
if (num > biggest_so_far):
biggest_so_far = num
return biggest_so_far
def contains_even(list):
found = False
for num in list:
if (num % 2 == 0):
found = True
break
return found
# Returns if every number is even
def is_all_even(list):
all_even = True
for num in list:
if (num % 2 == 1):
all_even = False
break
return all_even
# Remove Every Odd
def filter_odds(list):
for num in list:
if (num % 2 == 1):
list.remove(num)
return list
# multiply every number in list by 2
def mult_by_two(list):
new_list = []
for num in list:
new_num = num * 2
new_list.append(new_num)
return new_list