• Wrong document? Swap it for free
  • Written by students who passed
  • Immediately available after payment
  • Read online or as PDF
Sell
Where do you study
Your language
Document preview thumbnail
Preview 1 out of 1 pages
Other

COP1000C Unit 2 Assignment

Document preview thumbnail
Preview 1 out of 1 pages

Create a program. Write a program that requests the download speed in megabits per second (Mbs) and the size of a file in megabytes (MB). The program should calculate the download time for the file. Note that in this context one byte is eight bits. Use type float, and use / for division. The program should report all three values (download speed, file size, and download time) showing two digits to the right of the decimal point, as in the following: At 18.12 megabits per second, a file of 2.20 megabytes downloads in 0.97 seconds.

Content preview

Unit 2 Assignment

Creating a program that request the download speed in megabits per second and the
size of a file in megabytes.


Algorithm
1. request the download speed in megabits per second
2. Request the file size in megabytes
3. Convert file size from MB to megabites
4. Calcuate the download time in seconds
5. Display the download speed, file size, and download time with two decimal
places
"""


def main():
#Request the download speed in megabits per second
download_speed = float(input("Enter the download speed (Mbs):"))


#Request the file size in megabytes
file_size = float(input("Enter the file size (MB): "))


#Convert file size from MB to megabites
file_size_in_bits = file_size * 8


# Calcuate the download time in seconds
download_time = file_size_in_bits/download_speed


#Display the download speed, file size, and download time with two decimal places
print(f"Download speed: {download_speed:.2f} Mbs")


print(f"File size: {file_size:.2f} MB")


print(f"Download time: {download_time:.2f} seconds")



main()

Document information

Uploaded on
April 23, 2025
Number of pages
1
Written in
2023/2024
Type
Other
Person
Unknown
$6.79

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Seller avatar
Reputation scores are based on the amount of documents a seller has sold for a fee and the reviews they have received for those documents. There are three levels: Bronze, Silver and Gold. The better the reputation, the more your can rely on the quality of the sellers work.
byrena
3.5
(4)
Sold
10
Followers
8
Items
6
Last sold
11 months ago



Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions