Answered step by step
Verified Expert Solution
Question
1 Approved Answer
PYTHON 3. Lists 11 (25%). The user will enter a space-delimited list of integers, then an integer, X, then a string, S. The program will
PYTHON
3. Lists 11 (25%). The user will enter a space-delimited list of integers, then an integer, X, then a string, S. The program will sort the inputted list and per number n, in the sorted list, do one of the following: a. Print S if n is evenly divisible by X b. Print the n if X is NOT evenly divisble by X You may assume that all inputted numbers are integers and greater than 0. Example run Enter numbers: 61 2 4 5 Enter X: 2 Enter string: apples 1 apples apples apples 1. The user inputs the list and sorts it such that the list is now: [1, 2, 4, 5, 6] 2. X is set to 2, S is set to 'apples 3. The list is iterated. 4. '1' is printed, because X is not evenly divisible by n (1 is not evenly divisible by 2) 5. 'apples' is printed, because X is evenly divisible by n (2 is evenly divisible by 2) 8. 'apples' is printed, because X is evenly divisible by n (6 is evenly divisible by 2)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started