Thread: Please Help me!

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2013
    Posts
    8
    Rep Power
    0

    Please Help me!


    Hello,

    I need help about below python programs. I couldn't. Could you help me, please?

    Develop and test a Python program that determines how many images can be stored on a given size USB (fl ash) drive. The size of the USB drive is to be entered by the user in gigabytes (GB). The number of images that can be stored must be calculated for GIF, JPEG, PNG, and TIFF image fi le formats. The program output should be formatted as given below. Enter USB size (GB): 4 xxxxx images in GIF format can be stored xxxxx images in JPEG format can be stored xxxxx images in PNG format can be stored xxxxx images in TIFF format can be stored The ultimate fi le size of a given image depends not only on the image format used, but also on the image itself. In addition, formats such as JPEG allow the user to select the degree of compression for the image quality desired. For this program, we assume the image compression ratios given below. Also assume that all the images have a resolution of 800 3 600 pixels. Thus, for example, a 800 3 600 resolution image with 16-bit (2 bytes) color depth would have a total number of bytes of 800 3 600 3 2 5 960,000. For a compression rate of 25:1, the total number of bytes needed to store the image would be 960000/25 5 38400. Finally, assume that a GB (gigabyte) equals 1,000,000,000 bytes, as given in Figure 2.1.

    Format color depth Compression
    GIF 256 Colors 8 bits lossless 5.1 Jpeg 16 million colors 24 bits lossy 25.1 png 16 million colors 24 bits lossless 8.1 tiff 280 trillion colors 48 bits lossless n/a

    Note that a “lossless” compression is one in which no information is lost. A “lossy” compression does lose some of the original information.

    Best,

    john B.
  2. #2
  3. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2005
    Posts
    588
    Rep Power
    64
    Give us some code you have done so far.
    Real Programmers always confuse Christmas and Halloween because Oct31 == Dec25
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2013
    Posts
    8
    Rep Power
    0
    thnk u for quic reply Dietrich,

    I need help about this problem. I don't use before any language programming. And I must solve this problem with pyhton. Could you help me, plesae?
    thks
  6. #4
  7. Commie Mutant Traitor
    Devshed Intermediate (1500 - 1999 posts)

    Join Date
    Jun 2004
    Location
    Norcross, GA (again)
    Posts
    1,804
    Rep Power
    1569
    Could you show us what you have tried so far, please?

    I hope you don't expect us to write the program for you,a s no one here will.
    Rev First Speaker Schol-R-LEA;2 JAM LCF ELF KoR KCO BiWM TGIF
    #define KINSEY (rand() % 7) λ Scheme is the Red Pill
    Scheme in ShortUnderstanding the C/C++ Preprocessor
    Taming PythonA Highly Opinionated Review of Programming Languages for the Novice, v1.1

    FOR SALE: One ShapeSystem 2300 CMD, extensively modified for human use. Includes s/w for anthro, transgender, sex-appeal enhance, & Gillian Anderson and Jason D. Poit clone forms. Some wear. $4500 obo. tverres@et.ins.gov
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2013
    Posts
    8
    Rep Power
    0
    I said that before, I don't have any programming languages. So, I need a help.
    How can find image in the usb, how many images can be stored on a given size USB.
    What am I use commands. Where do I start.
    I can tried this.
    import sys

    size_GB = float(input('Enter USB size (GB): '))
    except:
    print('Specify the size as a number.')
    print('FAIL! Do you want run this program again.')
    sys.exit(1)

    size = size_GB * 1e9 # size is in bytes
    print('USB stores approximately {:d} bytes.'.format(int(size)))

IMN logo majestic logo threadwatch logo seochat tools logo