Last active
October 10, 2015 17:08
-
-
Save westurner/3723237 to your computer and use it in GitHub Desktop.
Mobile data/voice cost comparison
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AMR = {'12.20':12.20} | |
def calculate_data_mb(minutes=10, kbps=AMR['12.20']): | |
seconds = minutes*60 | |
kilobits = (kbps*seconds) / 8.0 | |
mb = float(kilobits) / 1024.0 | |
return mb | |
def data_transfer_in_minutes(transfergb=0.134, kbps=AMR['12.20']): | |
gbits = transfergb * 1024**3 * 8.0 | |
seconds = (gbits / (kbps * 1024.0)) | |
return seconds / 60.0 | |
minutes = 1500 | |
mb = calculate_data_mb(minutes) | |
print("%d minutes = %.3f mb" % (minutes, mb)) | |
assert data_transfer_in_minutes(mb / 1024.0) == minutes | |
data = 1 | |
print("%.3f gb = %.2f minutes" % (data, data_transfer_in_minutes(data))) | |
# 1500 minutes = 134.033 mb | |
# 1.000 gb = 11459.85 minutes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment