Question: create a program without using loops Sometimes our program might get some data that we'd like to sort into multiple categories. In this problem,

create a program without using loops Sometimes our program might get some data that we'd like to sort into

create a program without using loops Sometimes our program might get some data that we'd like to sort into multiple categories. In this problem, you will determine if some input numbers are even or odd, and sort them into lists of the 2 categories. Your program, even odd.py should create 2 empty lists named evens and odds. It should prompt the user to enter 2 numbers. For each of the numbers, it should determine whether the number is even or odd, and place the number into the appropriate list. It should also print out a message for each number, either: NUMBER is odd. NUMBER is even. For example: >>> %Run even odd.py Enter a number: 37 Enter a number: 12 37 is odd. 12 is even. Your program should not use loops. Note #1: A integer n is even if n % 2 == 0. It is odd if n % 2 == 1. Note #2: The word "sort" can have two distinct meanings. We can sort items into categories, as in "I sorted my white socks into one drawer and my dark socks into another." Sorting can also describe the process of rearranging a sequence of items into a desired order, as in: "These names need to be sorted alphabetically." This question uses the first meaning of sort: to place into categories.

Step by Step Solution

3.56 Rating (163 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

You can achieve the desired functionality in Python without using loops by using recursive functions ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!