sdckey

3s and 5s

Jun 4th, 2020
1,112
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import argparse
  2.  
  3. def DivisibleByThree(value) :
  4.     return value % 3 == 0
  5.  
  6. def DivisibleByFive(value)  :
  7.     return value % 5 == 0
  8.  
  9. def DivisibleByThreeAndFive(value)   :
  10.     return DivisibleByThree(value) and DivisibleByFive(value)
  11.  
  12. parser = argparse.ArgumentParser(description='Check for 3s and 5s.')
  13. parser.add_argument('integer', type = int, help='the integer to check')
  14.  
  15. args = parser.parse_args()
  16.  
  17. i = args.integer
  18.  
  19. if DivisibleByThreeAndFive(i)  :
  20.     print(i, 'is divisible by 3 and 5.')
  21. elif DivisibleByThree(i)  :
  22.     print(i, 'is divisible by 3.')
  23. elif DivisibleByFive(i)  :
  24.     print(i, 'is divisible by 5.')
  25. else  :
  26.     print(i, 'is not divisible by 3 or 5.')
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×