I'm trying to make a simple program to print out a new list made out of the first and last element of a given list.
default_list = [5, 10, 15, 20, 25]
first_list = [7, 233, 76, 234, 2]
second_list = [0, 5, 2, 6, 3423456]
third_list = [768, 56, 234, 765, 2434, 78676, 345, 467, 353, 765343]
new_list = []
def list_ends(chosen_list):
new_list.append(chosen_list[0])
new_list.append(chosen_list[len(chosen_list) - 1])
print(new_list)
list_ends(input(": "))
but what happens is if I enter a word in input say "default_list" it gives me an answer [d, t] which I believe means it didn't call the list variable I created.