> masteringswe_
codingpython

Function - custom map implementation

Define function map(nums, func) that transforms the list of numbers, nums, into a resulting list of numbers with the function func applied to each nums element (this is a typical map function). Define func yourself - it must take in an int and output an int. Call your map function on the list of numbers and print the transformed list.

pythonnumbers = [4, 40, 3, 33, 13, 58, 46, 87, 4]

def map(nums, func):
		# ...
		
# define transform_num
		
mapped_nums = map(numbers, transform_num)
print(mapped_nums)