Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import argparse
- def DivisibleByThree(value) :
- return value % 3 == 0
- def DivisibleByFive(value) :
- return value % 5 == 0
- def DivisibleByThreeAndFive(value) :
- return DivisibleByThree(value) and DivisibleByFive(value)
- parser = argparse.ArgumentParser(description='Check for 3s and 5s.')
- parser.add_argument('integer', type = int, help='the integer to check')
- args = parser.parse_args()
- i = args.integer
- if DivisibleByThreeAndFive(i) :
- print(i, 'is divisible by 3 and 5.')
- elif DivisibleByThree(i) :
- print(i, 'is divisible by 3.')
- elif DivisibleByFive(i) :
- print(i, 'is divisible by 5.')
- else :
- print(i, 'is not divisible by 3 or 5.')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement