Python is not printing List functions

Question:

I wrote this code while i was in my university class. However, when i go to run the program nothing is printing into the console.

def create_list():
    return ["Playstation", "Xbox", "Steam", "iOS", "Googleplay"]

def get_info(my_list):
    return (my_list[0], my_list[-2], len(my_list))

def get_partial(my_list):
    return my_list[1:4]

def get_last_three(my_list):
    new_list = my_list[-3:]
    new_list.reverse()
    return new_list

def double_list(my_list):
    return (my_list * 2)

def amend(my_list):
    my_list[1] = "None"
    my_list.append("Bye")
    return my_list


if __name__ == "__Main__"():
    test_list = create_list()
    print(test_list)
    print(get_info(test_list))
    print(get_partial(test_list))
    print(get_last_three(test_list))
    print(double_list(test_list))
    print(amend(test_list))

While doing some messing around with the code it has started to print this error into the console.

if __name__ == "__Main__"():
TypeError: 'str' object is not callable
Asked By: DarkPhobos

||

Answers:

You need to remove the ‘()’ from the if statement, and make "main" lowercase, like below:

if __name__ == "__main__":

Answered By: clefbassman
Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.