HELP PYTHON Write a program that takes a list of S integers and performs the following functions. Create two functions, and each function takes a single parameter my_list , which is a Python list:...





HELP PYTHON


Write a program that takes a list of S integers and performs the following functions. Create two functions, and each function takes a single parameter
my_list, which is a Python list:



delete_prime(my_list)
- returns a list with all prime numbers removed. The function returns a new list, and the parameter input my_list is not modified.


Input: list

Return value: list


reverse_list(my_list)
- reverses my_list. The parameter input my_list is modified.


Input: list

Return value: None

Notes:



  • Since a list is a mutable object, you may need to make a copy of the original list to pass as input parameter to the function.

  • Modern mathematicians define a number as prime if it is divided by exactly two numbers. To keep things simple for this exercise, assume all elements of the list have a value greater than 1.

  • Constraint:
    You are not allowed to use my_list[::-1], my_list.reverse(), or reversed(my_list).








Input Format





Assume the inputs are integers.


The first line contains the integer
S
where
S
is the number of elements in the list. The next
S
lines each contain an integer
X. These are the elements in the list.








Constraints




The input list has at least 2 elements and a maximum of 30 elements: 2 <>
S
<= 30="" each="" element="" x="" in="" the="" list="" is="" between="" 2="" and="" 100:="" 2=""><>
X
<=>


Assume no invalid inputs are given. No text will be given as input, no negative integers, and there are enough inputs needed for the program to function correctly.


**You are not allowed to use my_list[::-1], my_list.reverse(), or reversed(my_list). **







Output Format




The output is two lists of integers - one with the prime numbers removed and the other the reverse of the original list.


SEE SAMPLE INPUTS AND OUTPUTS BELOW




Sample Input 0<br>7<br>4<br>7<br>10<br>3<br>90<br>6.<br>Sample Output 0<br>Prime Removed:<br>[4, 10, 90, 6]<br>Reversed:<br>[2, 6, 90, 3, 10, 7, 4]<br>

Extracted text: Sample Input 0 7 4 7 10 3 90 6. Sample Output 0 Prime Removed: [4, 10, 90, 6] Reversed: [2, 6, 90, 3, 10, 7, 4]
Sample Input 1<br>10<br>19<br>22<br>3<br>28<br>26<br>17<br>18<br>4<br>28<br>100<br>Sample Output 1<br>Prime Removed:<br>[22, 28, 26, 18, 4, 28, 100]<br>Reversed:<br>[100, 28, 4, 18, 17, 26, 28, 3, 22, 19]<br>

Extracted text: Sample Input 1 10 19 22 3 28 26 17 18 4 28 100 Sample Output 1 Prime Removed: [22, 28, 26, 18, 4, 28, 100] Reversed: [100, 28, 4, 18, 17, 26, 28, 3, 22, 19]
Jun 08, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here