ratio-calc/ratio.py

23 lines
498 B
Python
Raw Normal View History

2022-10-22 13:49:38 +03:00
#!/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))
2022-10-22 13:51:33 +03:00
print(' 4x3 = {0}x{1}'.format(width, width * 3 / 4))
2022-10-22 13:49:38 +03:00
print('16x9 = {0}x{1}'.format(width, width * 9 / 16))
else:
print('Enter width value!');
if __name__ == '__main__':
main()