From 705a9edf511ad135bf7b08b7fa8d45d34269e246 Mon Sep 17 00:00:00 2001 From: dwc808 Date: Mon, 1 Jan 2024 18:18:45 -0500 Subject: [PATCH] Started --- application.py | 17 +++++++++++++++++ application_test.py | 0 2 files changed, 17 insertions(+) create mode 100644 application.py create mode 100644 application_test.py diff --git a/application.py b/application.py new file mode 100644 index 0000000..8c2c039 --- /dev/null +++ b/application.py @@ -0,0 +1,17 @@ +def map(iterable, map_func) -> array: + """ + Takes an iterable data structure and function as paramaters and applies the function to all objects + in the iterable. Returns a new array with the resulting outputs. + + :param iterable: an iterable object to be altered by the map function + :param map_func: the function to call on each element of the iterable + :return: a new array whose elements are the altered objects from the original iterable + """ + + mapped_array = [] + + #iterate over original object, apply map_func to each and append outputs to mapped_array + for object in iterable: + mapped_array.append(map_func(object)) + + return mapped_array diff --git a/application_test.py b/application_test.py new file mode 100644 index 0000000..e69de29