CJCoding With Joseph
15free / daySign inCreate account

Division Fact Sheet

Write a program with no input that prints a five-line fact sheet about dividing 17 by 5. Declare the two integers with type hints as the numerator and the denominator, then compute three typed values: the quotient from true division / (a float), the whole part from floor division // (an int), and the leftover, which is the numerator minus the whole part times the denominator (an int, without using the remainder operator). Print a first line made of the numerator and the denominator passed as two values with sep= set to the words divided by with a space on each side, and end= set to a space, the word gives, a colon and a newline. Then print three lines, each starting with two spaces and a label (true division, floor division, leftover), a colon, then the value and then its type(), passed as three values to one print call so the default spaces separate them. Finish with an f-string line: Check, a colon and a space, then the whole part, an asterisk, the denominator, a plus sign, the leftover, an equals sign and the recomputed numerator (whole part times denominator plus leftover, done inside the braces), each part separated by single spaces. Input: none.

Expected Output:

17 divided by 5 gives:
  true division: 3.4 <class 'float'>
  floor division: 3 <class 'int'>
  leftover: 2 <class 'int'>
Check: 3 * 5 + 2 = 17

= newline. The output ends with a newline — print one after the last line.

Hints4 available
Topics:
PrintingOperators
1
Tab to indent (Esc then Tab to move on) · Ctrl+Enter to run · Ctrl+Space to expand shortcuts (pr, inp, def)

Your Output

Run your code to see the output here...

Test Cases

Run your code to see test case results.