about | help | code help+videos | done | prefs |
songs
When you (or your parents) rip songs from a CD, the digital file is created by sampling the sound at some rate. Common rates are 128 kbps (128 × 2^10 bits per second), 192 kbps, and 256 kbps. Write a function songs(capacity, bitrate) that returns the number of 4 minute songs someone can store on his or her iPod. The function's two parameters are the capacity of the iPod in gigabytes (GB) and the sampling rate in kbps. A gigabyte is 2^30 bytes and a byte contains 8 bits. Remember that there are no fractional songs, so round down by using the int() command when you return the final answer. songs(0, 1) → 0 songs(2, 128) → 546 songs(1, 128) → 273 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Copyright Nick Parlante 2017 - privacy