logo

Question detail

For each value below, state the result of rounding it to the nearest whole number and the result of truncating it to a whole number: 6.4 and 6.8. Include suitable Python 3 expressions.

Try the question, check the answer, then read the explanation to understand the curriculum point.

At a glance

Question

Type

practice

Style

Topic

Programming

Exam-style question

Try this first

For each value below, state the result of rounding it to the nearest whole number and the result of truncating it to a whole number: 6.4 and 6.8. Include suitable Python 3 expressions.

Model answer

What a good answer should say

  • For 6.4: round(6.4) gives 6 and int(6.4) gives 6.
  • For 6.8: round(6.8) gives 7 and int(6.8) gives 6.

Explanation

Why this works

Rounding selects the nearest whole number, so 6.4 rounds to 6 and 6.8 rounds to 7. Truncation removes the fractional part without increasing the value, so both 6.4 and 6.8 become 6 when converted to an integer using int().

Common mistake

No common mistake is linked to this question yet.

Related flashcards

No flashcards are published for this page yet.

Related practice questions

No questions are published for this page yet.