Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python 3.6.1 Part 1: Program Requirements (Without Functions) First, your program should print the following message on one line: This program determines if one number

Python 3.6.1

Part 1: Program Requirements (Without Functions)

First, your program should print the following message on one line:

This program determines if one number can be evenly divided by another.

Then, your program should ask for two numbers. Each prompt should say:

Enter number: 

The first number should be stored in a variable called first_number, and the second number should be stored in a variable called second_number.

Next, your program should compute the remainder when the first number is divided by the second number. (Hint: you should use the modulus operator.)

Finally, if the remainder was 0, your program should print:

divisible

If the remainder was not 0, your program should print:

not divisible

You should fulfill these requirements without making any functions.

Part 2: Decomposing Into Functions

Now, modify your program so that it has the following functions:

-----

print_intro

Description: This function should print the introductory message described above.

Parameters: none.

Return value: none.

get_number

Description: This function should ask the user for a number. It should then return the number they type as an int.

Parameters: none.

Return value: the number the user typed as an int.

is_divisible

Description: This function should accept two arguments and return True if the first is divisible by the second and False otherwise.

Parameters: two integers.

Return value: a boolean corresponding to whether the first parameter's value is divisible by the second parameter's value.

-----

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

Accounting And Auditing Research And Databases Practitioner's Desk Reference

Authors: Thomas R. Weirich, Natalie Tatiana Churyk, Thomas C. Pearson

1st Edition

1118334426, 978-1118334423

More Books

Students also viewed these Databases questions

Question

What do Dimensions represent in OLAP Cubes?

Answered: 1 week ago