Skip to content

Commit 35b768e

Browse files
committed
add starter functions
1 parent 9c72d84 commit 35b768e

File tree

4 files changed

+37
-9
lines changed

4 files changed

+37
-9
lines changed

function_a.py

+4-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,9 @@
1-
# Taken From
2-
# Iterating Over Data
3-
# Problem-Set While Loops #11
4-
def silly_sum():
5-
""" reads numbers from the user (use input_int)
6-
summing as we go until either
7-
the user enters 0, or
8-
the sum reaches or exceeds 1000
1+
def most_common_value(number_list):
2+
""" returns the most common element of the list
93
"""
104
pass
115

126

137
if __name__ == "__main__":
14-
silly_sum()
8+
nums = [1, 1, 3, 3, 3, 7, 8, 2, 1, 3]
9+
print(f"Most common value = {most_common_value(nums)}")

function_b.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Taken From
2+
# Iterating Over Data
3+
# Problem-Set While Loops #11
4+
def silly_sum():
5+
""" reads numbers from the user (use input_int)
6+
summing as we go until either
7+
the user enters 0, or
8+
the sum reaches or exceeds 1000
9+
"""
10+
pass
11+
12+
13+
if __name__ == "__main__":
14+
print(f"Answer = {silly_sum()}")

function_c.py

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
def merge_lists(list_a, list_b):
2+
""" Returns a new list which is
3+
a combination of list_a and list_b
4+
without any duplicate elements.
5+
"""
6+
pass
7+
8+
9+
if __name__ == "__main__":
10+
print(merge_lists([1, 1, 2, 3], [3, 4, 5]))

function_d.py

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
def max_value(numbers):
2+
""" This function returns the largest number
3+
in the list.
4+
"""
5+
pass
6+
7+
8+
if __name__ == "__main__":
9+
print(max_value([1, 12, 2, 42, 8, 3]))

0 commit comments

Comments
 (0)