""" Exercise 1.7 - Swap Units and tens """ # Copyright (c) 2021. Pascal Syma. All rights reserved. def swap_units_and_tens(num: int) -> int: """ Swap the last with the second last digit. :return: Swapped number :param num: Input number """ string = str(num) return int(string[:-2] + string[:-3:-1]) if __name__ == '__main__': print(f'{swap_units_and_tens(123) = }')