subject

Peyton is taking a part-time job to earn some extra money. Every week the manager will provide a list of tasks and the number of hours each task requires. The tasks have to be done one by one from the first one and Peyton would do so until the time spent on all finished tasks exceeds 10 hours. Please construct a function take_tasks, which takes one integer list as the argument task_hours and prints out how many hours and how many tasks Peyton would do for that week. For example, the program below tasks ([2, 1, 3, 1, 4, 2, 3])
will have the following output:
Finish 5 tasks in 11 hours
Note: you can use enumerate() to get the index of the task, which is available after the for loop terminates. However, keep in mind that index starts from 0.
time_spent = 0
time_spent = 10
if time_spent > 10: break
if time_spent > 0: break
for index, hour in task_hours:
print('Finish {} tasks in {} he
if time_spent == 10: break
def take_tasks (task_hours):
time_spent += index
time_spent += hour
for index, hour in enumerate

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 00:30
Write the html code to make a link out of the text “all about puppies”. it should link to a pdf called “puppies.pdf” inside the “documents” folder. the pdf should open in a new window.
Answers: 2
question
Computers and Technology, 23.06.2019 18:30
This program should be a short piece of code that prints all of the positive integers from 1 to 100 as described more fully below. the program may contain multiple methods, and if using an oo language, should be contained within a single class or object. the program should be designed so that it begins execution when invoked through whichever mechanism is most common for the implementation language. â–ş print out all positive integers from 1 to 100, inclusive and in order. â–ş print messages to standard output, matching the sample output below. â–ş in the output, state whether the each integer is 'odd' or 'even' in the output. â–ş if the number is divisible by three, instead of stating that the number is odd or even, state that the number is 'divisible by three'. â–ş if the number is divisible by both two and three, instead of saying that the number is odd, even or divisible by three; state that the number is 'divisible by two and three'. â–ş design the logic of the loop to be as efficient as possible, using the minimal number of operations to perform the required logic. sample output the number '1' is odd. the number '2' is even. the number '3' is divisible by three. the number '6' is divisible by two and three.
Answers: 1
question
Computers and Technology, 24.06.2019 20:20
Write python code that prompts the user to enter his or her favorite color and assigns the user’s input to a variable named color.
Answers: 1
question
Computers and Technology, 25.06.2019 04:20
Austin rare coins, inc., buys and sells rare coins, bullion, and other precious metals through eight web sites with different domain names. an unknown individual took control of austin's servers and transferred the domain names to another registrant without austin's permission. the new registrant began using the domain names to host malicious content—including hate letters to customers and fraudulent contact information—and to post customers' credit-card numbers and other private information, thereby tarnishing austin's goodwill. austin filed a suit in a federal district court against the new registrant under the anticybersquatting consumer protection act. is austin entitled to a transfer of the domain names? austin rare coins, inc., buys and sells rare coins, bullion, and other precious metals through eight web sites with different domain names
Answers: 3
You know the right answer?
Peyton is taking a part-time job to earn some extra money. Every week the manager will provide a lis...
Questions
question
Social Studies, 06.05.2020 09:05
Questions on the website: 13722361