1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
lakkis [162]
3 years ago
8

Write a program called nearest_multiple.py that asks the user to input a number (here I will call it num) and a strictly positiv

e integer (here I will call it mult) and prints as output the closest integer to num that is a multiple of mult
Computers and Technology
1 answer:
kozerog [31]3 years ago
8 0

Answer:

The program is as follows:

num = float(input("Enter a decimal (float): "))

mult = int(input("Enter a positive whole (int): "))

small = (num // mult) * mult

big = small + mult

print(num,"rounded to the nearest multiple of ",mult,"is",end=" ")

print(big if num - small > big - num else small)

Explanation:

This gets input for num

num = float(input("Enter a decimal (float): "))

This gets input for mult

mult = int(input("Enter a positive whole (int): "))

This calculates the smaller multiple

small = (num // mult) * mult

This calculates the larger multiple

big = small + mult

This prints the output header

print(num,"rounded to the nearest multiple of ",mult,"is",end=" ")

This prints small if small is closer to num, else it prints big

print(big if num - small > big - num else small)

You might be interested in
What is the danger in judging someone according to his or her social networking profile
AfilCa [17]
They could find you and throw hands.
8 0
3 years ago
A collection of realated files is called a
Thepotemich [5.8K]

The answer to this question would be:

database/records

They all have in common the same files.

4 0
3 years ago
When you ____ an exception, you send a message that an error has occurred to another part of the program.
jekas [21]
The correct answer is most definitely B
8 0
3 years ago
Read 2 more answers
Which layer in the Transmission Control Protocol/Internet Protocol (TCP/IP) model is responsible for delivering data between two
s2008m [1.1K]

Answer:

Network.

Explanation:

The Transmission Control Protocol/Internet Protocol (TCP/IP) model is a standard networking protocol which allows network devices such as routers, switches, and host computers to interconnect and communicate with one another over a network. The Transmission Control Protocol/Internet Protocol (TCP/IP) model comprises of four (4) layers and these includes;

I. Application layer.

II. Transport layer.

III. Internet layer.

IV. Network layer.

The network layer in the Transmission Control Protocol/Internet Protocol (TCP/IP) model is responsible for delivering data between two nodes.

Basically, this layer known as network layer is the fourth layer of the Transmission Control Protocol/Internet Protocol (TCP/IP) model and it is typically responsible for the transmission of packets from one network device to another.

4 0
3 years ago
The listing of a directory shows certain files with permissions set to rwsr-xr-x. what does this indicate?
marta [7]
<span>"rws" means that the user has permissions to read, write and setuid. "r" means the user can read the file and "w" means that the user can write to the file. "s" stands for "setuid" (set user id) is a permission bit that allows the users to execute a program with the permissions of its owner. The "s" can also mean "setgid" (set group id) is a bit that allows the user to execute a program with the permissions of the group owner.</span>
5 0
4 years ago
Other questions:
  • You maintain an RODC running Windows Server 2012 R2 at a branch office, and you want Juanita, who has solid computer knowledge,
    13·1 answer
  • SQL a. has become the de facto standard database language b. can be used to define database systems c. both a. and b. d. none of
    10·1 answer
  • How do you measure objects and re-size them in tinkercad? I need it in steps.
    7·1 answer
  • Which of the following is NOT one of the modules of a typical Decision Support System (DSS)? Select one: a. Customer information
    14·2 answers
  • Recently, your laptop won't power on, and the battery is not charging. You suspect the block on the power cord (also known as a
    5·1 answer
  • your friend's parent's are worried about going over their budget for the month. Which expense would you suggest is NOT a need?
    11·1 answer
  • highlight the possible risks and problems that should be address during the implementation of information system process
    5·1 answer
  • Using Microsoft Word, write a 250-word essay on the fading of home telephone use with the advent of recent technology, and share
    14·1 answer
  • Dora has inserted a text box into a Word document that she is formatting. Which strategy will not format text boxes? Create a li
    6·2 answers
  • Which bits of the address would be used in the tag, index and offset in a two-way set associative cache with 1-word blocks and a
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!