Advertisement
rex9840

Untitled

Nov 15th, 2021
843
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.87 KB | None | 0 0
  1. # Greeting of the Program
  2. print('Welcome to the "Picures on the Go" Program')
  3. print()
  4.  
  5. print('This Program will determine how many images can be stored on the USB Drive, given the space offered')
  6. print()
  7.  
  8.  
  9. program = False
  10.  
  11. while program == False:
  12.  
  13. # USB Space Offered
  14.     userUSB =int(input('Enter the amount of space on your USB Drive in Gigabytes (GB) : '))
  15.     print()
  16.  
  17.     # Camera Resolution
  18.     print('Please Enter the MegaPixels of your camera (8, 12, 16): ')
  19.     # mP = input('Please Enter the camera resolution offered, in Mega Pixels: ')
  20.     mP=input()
  21.     if mP =='8':
  22.         res= 3264*2448
  23.     elif mP =='12':
  24.         res= 4290*2800
  25.     elif mP =='16':
  26.         res = 4920*3264
  27.         print()
  28.  
  29.  
  30.     # Calculations
  31.  
  32.     gIFBytes = (res * 1) / 5
  33.     pNGBytes = (res * 3) / 10
  34.     jPEGBytes = (res * 3) / 8
  35.     tIFFBytes = (res * 6)
  36.  
  37.     storageUSB = userUSB * 1000000000
  38.  
  39.     gIFPictures = storageUSB //gIFBytes
  40.     pNGPictures = storageUSB //pNGBytes
  41.     jPEGPictures = storageUSB //jPEGBytes
  42.     tIFFPictures = storageUSB //tIFFBytes
  43.  
  44.     # Display the Results of the Calculations
  45.  
  46.     print('The amount of pictures that your USB Drive can hold is: ')
  47.     print('For GIF Pictures', format( gIFPictures,'.2f'))
  48.     print('For PNG Pictures', format( pNGPictures,'.2f'))
  49.     print('For JPEG Pictures', format( jPEGPictures,'.2f'))
  50.     print('For TIFF Pictures', format( tIFFPictures,'.2f'))
  51.  
  52. # This section will prompt the user if they want to run the program again
  53.  
  54.     print()
  55.     response = input("Would you like to run this program again? (y/n: )")
  56.     response = response.lower()
  57.     print()
  58.  
  59.     while response != 'y' and response != 'n':
  60.         input("Please Enter 'y' or 'n': ")
  61.         response = response.lower()
  62.     if response == 'n':
  63.             program = True
  64.     elif response != 'y':
  65.             program = False
  66.     print()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement