Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprenda Challenge: Time Calculation in Python | Conhecendo os números em Python
Tipos de Dados em Python

book
Challenge: Time Calculation in Python

Tarefa

Swipe to start coding

Imagine you are a bookkeeper, and you need to process 10 financial transactions. You've noticed that each transaction takes an average of 7 minutes, but you only have 60 minutes available.

  1. Calculate how many transactions you couldn't complete and assign the result to the variable remaining_tasks.
  2. Calculate how many minutes would be needed to complete all 10 transactions if each takes 7 minutes, and assign the result to the variable required_time.

Solução

# Number of completed transactions
completed = 60 // 7
# Number of remaining minutes
minutes = 60 % 7
# Set the number of remaining transactions
remaining_tasks = 10 - completed
# Set the total time needed to complete all transactions
required_time = 10 * 7

# Print the results
print("The number of remaining transactions is", remaining_tasks)
print("The number of minutes needed to complete all transactions is", required_time)
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 1. Capítulo 6
# Number of completed transactions
completed = 60 // 7
# Number of remaining minutes
minutes = 60 % 7
# Set the number of remaining transactions
remaining_tasks = ___
# Set the total time needed to complete all transactions
required_time = ___

# Print the results
print("The number of remaining transactions is", ___)
print("The number of minutes needed to complete all transactions is", ___)

Pergunte à IA

expand
ChatGPT

Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo

some-alt