Respuesta :

Answer:

The function written in python is as follows;

def main():

      user_input = int(input("Input: "))

      mylist = []

      while not user_input == 0:

             mylist.append(user_input)

             user_input = int(input("Input: "))

      print(mylist)

 

if __name__ == "__main__":

      main()

Explanation:

This line declares a main function with no arguments

def main():

This line prompts user for input

      user_input = int(input("Input: "))

This line declares an empty list

      mylist = []

The following iteration checks if user input is not 0; If yes, the user input is appended to the list; otherwise, the iteration ends

      while not user_input == 0:

             mylist.append(user_input)

             user_input = int(input("Input: "))

This liine prints the list in the order which it was inputted

      print(mylist)

 

The following lines call the main function

if __name__ == "__main__":

      main()

ACCESS MORE