user = None money = 10000 user = input('please input your name->') def queryMoney(flag=False): if flag: print(f'Query Money') print(f'{user}\'s money is ¥{money:,}') def saveMoney(mon): print(f'Save Money') global money money += mon print(f'{user} save money ¥{mon}') queryMoney() def getMoney(mon): print(f'Get Money') global money money -=mon print(f'{user} get money ¥{mon}') queryMoney() def main(): tips = 'main menu' print(f'{tips:*^60}') tips = f'welcome {user} to Python, please choose' print(f'{tips:^60}') print('*'*60) print(f'query\t[1]') print(f'save\t[2]') print(f'get\t[3]') print(f'exit\t[4]') return input('your choice->') while True: key = main() if key == '1': queryMoney(True) continue elif key == '2': mon = input('money you want to save ->¥') saveMoney(int(mon)) continue elif key == '3': mon = input('money you want to get ->¥') getMoney(int(mon)) continue else: print(f'88, {user}') break