Hackety Hacking Problem BPM Converter: Difference between revisions
Jump to navigation
Jump to search
(New page: == Problem Statement == Your DJ friend has an enormous collection of vinyl records. She knows the Beats per minute (BPM) of all the records at 45rpm but wants to know how these BPMs will...) |
(Add category.) |
||
(One intermediate revision by one other user not shown) | |||
Line 33: | Line 33: | ||
print("The BPM for this record at 33rpm will be approximately ", slowbpm, "bpm.") |
print("The BPM for this record at 33rpm will be approximately ", slowbpm, "bpm.") |
||
</pre> |
</pre> |
||
[[Category:Summer of Content]] |
|||
[[Category: Hackety Lesson Plan]] |
Latest revision as of 04:58, 6 April 2008
Problem Statement
Your DJ friend has an enormous collection of vinyl records. She knows the Beats per minute (BPM) of all the records at 45rpm but wants to know how these BPMs will change if she plays the records at 33rpm. She's figured out that the proportion of 45/33 is important but isn't sure how this will affect the BPMs. Can you write a program for this DJ so that she can easily figure out what the BPMs of her 45rpm records will be when she plays them at 33rpm?
Sample Output
Please enter the BPM at 45rpm and press ENTER: 120 The BPM for this record at 33rpm will be approximately 88.0bpm.
Curriculum Connections
To solve this problem, students will:
- Take input from a user
- Store input in a variable
- Perform floating-point division
- Output data to the user
- Demonstrate an understanding of proportions
Solution
# First, we ask the user for the bpm of the record on its normal speed # and store this answer into a variable called bpm bpm = input("Please enter the BPM at 45rpm and press ENTER: ") # Next, we convert this bpm to the slower speed and store this answer in # a variable called slowbpm slowbpm = bpm * (33.0 / 45.0) # Finally, we print a friendly message to the user with the answer. print("The BPM for this record at 33rpm will be approximately ", slowbpm, "bpm.")