Question
Find solutions for your homework or get textbooks home / study / engineering / computer science / computer science questions and answers / brutus the
Find solutions for your homework or get textbooks
home / study / engineering / computer science / computer science questions and answers / brutus the labrador retriever loves to chase tennis balls all day long. you can calculate how ...
Question: Brutus the labrador retriever loves to chase tennis balls all day long. You can calculate how far...
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')
please us python. please write a simple script I can understand. thanks
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started