1234567891011121314151617181920212223242526272829303132 |
- #!/bin/python3
- from argparse import ArgumentParser
- from core import *
- def main():
- arg_parser = ArgumentParser("temperature_convertor")
- arg_parser.add_argument('start_t',
- type=int,
- help="Start temperature")
- arg_parser.add_argument('-t1', '--start-type',
- required=True, choices=['C', 'K', 'F'],
- help='Start temperature type')
- arg_parser.add_argument('-t2', '--finish-type',
- required=True, choices=['C', 'K', 'F'],
- help='Finish temperature type')
- arg = arg_parser.parse_args()
- convert = f"{arg.start_type}>{arg.finish_type}"
- finish_t = round(get_func[convert](arg.start_t), 2)
- print(finish_t)
- if __name__ == "__main__":
- main()
|