phyton – GB File Conversion

######### Pseudocode ##########
# For main ()
# prompt user to input amount of gb, assign to gb
# convert gb to 1,000,000,000 bytes x gb(float) input, assign to gbyte
# run gbyte function, passing to gif, jpeg, png, and tiff.
# assume all images have a resolution of 800x600px
# GIF=(gbyte)/(800x600x1/5) images in GIF format can be stored.
# JPEG=(gbyte)/(800x600x3/25) images in JPEG format can be stored.
# PNG=(gbyte)/(800x600x3/8) images in PNG format can be stored.
# TIFF=(gbyte)/(800x600x6) images in TIFF format can be stored.
################START##########################
#Converting gigabytes into bytes for further processing.
def calc_byte(gb):
    bytes = gb * 1000000000
    gif_capacity (bytes)
    jpeg_capacity (bytes)
    png_capacity (bytes)
    tiff_capacity (bytes)
#Calculating the capacity of GIF files for the given amount of memory.
def gif_capacity (bytes):
    capacity = bytes / (800*600*1/5)
    print(format(capacity,‘.3f’)‘images in GIF format can be stored.’)
#Calculating the capacity of JPEG files for the given amount of memory.
def jpeg_capacity (bytes):
    capacity = bytes / (800*600*3/25)
    print(format(capacity,‘.3f’)‘images in JPEG format can be stored.’)
#Calculating the capacity of PNG files for the given amount of memory.
def png_capacity (bytes):
    capacity = bytes / (800*600*3/8)
    print(format(capacity,‘.3f’)‘images in PNG format can be stored.’)
#Calculating the capacity of TIFF files for the given amount of memory.
def tiff_capacity (bytes):
    capacity = bytes / (800*600*6)
    print(format(capacity,‘.3f’)‘images in TIFF format can be stored.’)
# Defining user input as gb, printing limitations, and showing capacity for each file type.
def main ():
    gbyte = float(input(‘Hello, welcome to GB File Conversion. Please input the capacity of your storage device in gigabytes!’)
    calc_byte(gbyte)
#Call the main function and execute the program.
main ()

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.