ratio-calc/ratio.py
2022-10-22 13:51:33 +03:00

23 lines
498 B
Python
Executable File

#!/usr/bin/env python3
from sys import argv
def main():
width = 0
if (len(argv) > 1):
try:
width = int(argv[1])
except ValueError as e:
print('ValueError: Enter integer value!')
exit(1)
print('Width: {0}'.format(width))
print(' 4x3 = {0}x{1}'.format(width, width * 3 / 4))
print('16x9 = {0}x{1}'.format(width, width * 9 / 16))
else:
print('Enter width value!');
if __name__ == '__main__':
main()