Answered step by step
Verified Expert Solution
Link Copied!

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

PYTHONimage text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems 6th Asian Conference Aciids 2014 Bangkok Thailand April 7 9 2014 Proceedings Part I 9 2014 Proceedings Part 1 Lnai 8397

Authors: Ngoc-Thanh Nguyen ,Boonwat Attachoo ,Bogdan Trawinski ,Kulwadee Somboonviwat

2014th Edition

3319054759, 978-3319054759

More Books

Students also viewed these Databases questions