Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Apprendre Challenge: Time Calculation | Getting Familiar With Numbers in Python
Data Types in Python

book
Challenge: Time Calculation

Tâche

Swipe to start coding

The task description remains unchanged. I will recap it for your reference and introduce two additional questions.

Imagine that you are a school student and have to solve 10 math tasks. You have noticed that the average time to deal with the task is 7 minutes; however, you have 60 minutes.

  1. Calculate how many tasks you did not complete and assign the result to the variable remaining_tasks.
  2. Calculate how many minutes you would need to complete 10 tasks if you were to spend 7 minutes on each of them, and assign the result to the variable required_time.

Solution

completed = 60//7
minutes = 60 % 7
# Set the number of remaining tasks
remaining_tasks = 10 - completed
# Set the number of minutes you need to complete all tasks
required_time = 10 * 7

# Print the result
print("The number of remaining tasks is", remaining_tasks)
print("The number of minutes for completing the tasks is", required_time)

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 1. Chapitre 6
completed = 60 // 7
minutes = 60 % 7
# Set the number of remaining tasks
remaining_tasks = ___
# Set the number of minutes you need to complete all tasks
required_time = ___

# Print the result
print("The number of remaining tasks is", ___)
print("The number of minutes for completing the tasks is", ___)
toggle bottom row
some-alt