Question: This activity is worth 10 total points This lesson's Group Activities are (do both): 1. Brutus the labrador retriever loves to chase tennis balls all

This activity is worth 10 total points

This lesson's Group Activities are (do both):

1. Brutus the labrador retriever loves to chase tennis balls all day long. You can calculate how far he has run using this formula:

distance = speed * time

As an example, Brutus ran for two hours and ran 15 kilometers per hour. So, (15 kph) * (2 hours) = 30 kilometers.

Write a program that Brutus's owner can use to track his distance. It should:

Allow Brutus's owner to input the speed of his dog

Allow Brutus's owner to input the hours Brutus was playing fetch

Loop to display the distance Brutus ran for each hour like this:

How long did Brutus play fetch? 3 How fast did Brutus run? 12 ========================================== Hour Brutus's Distance ========================================== 1 12 km 2 24 km 3 36 km

Helpful Hint: you've already ready about escape sequences in Lesson 1, but it is useful to really see them in practice. You can make your outputs prettier and more precise by using tabs to seperate your text. To add a tab to a string in Python, you use what's called an escape sequence to represent the tab: \t. An escape sequence tells the program not to literally print \t but to treat it as a tab. To create the the output header for Brutus, you would type something like this:

print('Hour\tBrutus\'s Distance')

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!