def copy_me(input_list):
''' (list) -> list
This function will copy the list and will do the following to it:
change every string into an upper case, increase the value of every
integer and float by 1, negate every boolean and replace lists with the
word 'List'. After the modifications are made, the copied list will be
returned. (The original inputted list won't be mutated)
REQ: The list must only contain the following data types: str, int,
float, bool, list.
>>> copy_me(['hi', 1, 1.5, True, ['sup', 123])
['HI', 2, 2.5, False, 'List']
'''
# Copy the list
copied_list = input_list.copy()
# Go through each element of list
for index, element in enumerate(copied_list):
print(type(element))
if (type(element) == str):
copied_list[index] = element.upper()
elif (type(element) == int or float):
copied_list[index] = element + 1
elif (type(element) == bool):
if (element == True):
copied_list[index] = False
elif (element == False):
copied_list[index] = True
print(copied_list)
doing something like:
>>> copy_me([True])
[2]
That makes no sense to me. Can anyone explain why and how I can get it to return False as the value?