Question: Write a Python program that prompts the user to input the size of a list and the integers to populate the list and print the
Write a Python program that prompts the user to input the size of a list and the integers to populate the list and print the list members one by one, the odd numbers in the list and the negative numbers by calling different functions. Your program should have the following requirements: (1) The program should have four functions: a. The get_numbers(size) function should prompt the user to input size integers, which should be stored in a list called my list and return the list. b. The print_all_numbers(my_list) function should take a list of integers as an argument and print out all the numbers in the list. c. The print_odd_numbers(my_list) function should take a list of integers as an argument and print out all the odd numbers in the list. If there are no odd numbers in the list, it should print "No odd number in the list". d. The print_negative_numbers(my list) function should take a list of integers as an argument and print out all the negative numbers in the list. If there are no negative numbers in the list, it should print "No negative number in the list". (2) Outside the function, you do the following: a. Prompt the user to enter the size of the list (integer). This part is provided in the template file. b. Call the function get_numbers(size) with value entered by the user for size. This function will return the values the user entered as a list called my_list. c. Call the function print_all_numbers(my_list) with my_list as an argument. d. Call the function print_odd_numbers(my_list) with my_list as an argument. e. Call the function print_negative_numbers(my_list) with my_list as an argument
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
