answer.
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
kow [346]
2 years ago
13

The fractional_part function divides the numerator by the denominator, and returns just the fractional part (a number between 0

and 1). Complete the body of the function so that it returns the right number. Note: Since division by 0 produces an error, if the denominator is 0, the function should return 0 instead of attempting the division.
Computers and Technology
2 answers:
Luba_88 [7]2 years ago
5 0

Answer:

def fractional_part(numerator,denominator):

  if denominator == 0:

      return 0

  else :

      return (numerator/denominator)%1

Explanation:

m_a_m_a [10]2 years ago
5 0

Answer:

import math

def fractional_part(num, den):

   if den == 0:

      return 0

   return num / den - math.floor(num / den)

print(fractional_part(5,4)) // outputs 0.25

print(fractional_part(6,4)) // outputs 0.5

print(fractional_part(12,0)) // outputs 0

Explanation:

  • Using Python Programming Language:
  • Import math (Enables the use of the math.floor function)
  • Create an if statement to handle situations of denominator equals to zero
  • Dividing the floor (lower bound) of the numerator (num) by the denominator (den) and subtracting from the value of num / den gives the fractional part.
You might be interested in
Using the expected format, of putting key information where the reader can’t find it, is an example of?
Brums [2.3K]
The answer is professional etiquette.
6 0
2 years ago
Read 2 more answers
The Spinning Jenny reduced the number of workers necessary to _______. a.remove cotton seeds from fibers b.pump water from the m
bazaltina [42]

The answer is D: Turn yarn into cloth.

During the industrial revolution, a number of new inventions in the textile industry greatly impacted this industry. However, it was the invention of the Spinning Jenny that is credited a lot. It helped move the textile industry from homes to factories and made wool spinning easier and faster. This invention, however, impacted the labor workforce. It reduced the amount of work needed to produce yarn. One worker was able to work 8 or more spools at once and rose to 120 due to technological advancements.

5 0
2 years ago
Which of the following statements are true. .ascii stores string in memory and terminate it with NULL character. There is no way
Tems11 [23]

Answer:

The true statements are:

There is an assembler directive to arrange / place floating point values in static data memory

MARS always uses setting '.set boat'

Explanation:

It is the assembler directive who arranges and places the floating point values for the static data memory. Obviously there is no such way for the MIPS assemble programming for reservation of the static data memory without having any initialization for a considerable value.

MARS would definitely use the setting set “noat” ascii would store the string in the memory and then terminate it with respect to NULL character. They cannot reserve the MIPS assembly programming for a considerable value.

4 0
2 years ago
Which fact does lean green eco machines present to show that electric cars are not perfect
Yuri [45]

Answer: HOPE THIS HELPED YOU! :D ;)

Eco cars are still too expensive for most car buyers

Explanation:

5 0
2 years ago
Read 2 more answers
Insert the appropriate functions in the Summary Statistics section of the worksheet: cells H18:H22. Format the payments with Acc
liberstina [14]

Answer:

Explanation:

If we want to insert the appropriate functions, we can know the operation, for example, it could be a sum, multiply, average or only divide, but if we want to apply for a format number like accounting number, we must go to the tab home and the section number, we can change the format number, an accounting or even text format.

8 0
2 years ago
Other questions:
  • Currently, there are two major techniques used to develop programs and their procedures. name and describe them. html editor key
    11·1 answer
  • PHP is based on C rather than ______.
    5·1 answer
  • A database design where certain data entities are combined, summary totals are carried in the data records rather than calculate
    5·1 answer
  • A company wants to publish Knowledge articles to its Customer Community. The articles should be organized for easy navigation by
    6·1 answer
  • JAVA
    7·1 answer
  • Python
    9·1 answer
  • In this exercise we look at memory locality properties of matrix computation. Th e following code is written in C, where element
    9·1 answer
  • Define the instance method inc_num_kids() for PersonInfo. inc_num_kids increments the member data num_kids. Sample output for th
    10·1 answer
  • Write a loop to populate the list user_guesses with a number of guesses. The variable num_guesses is the number of guesses the u
    13·1 answer
  • Given positive integer n, write a for loop that outputs the even numbers from n down to 0. If n is odd, start with the next lowe
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!