ZhangZhihui's Blog  

You can translate this fragment into Python by arranging the choices and functions into a dictionary:
actions = {0: make_computer_move, 1: make_human_move}
actions.get(choice, report_error)()

 

posted on 2022-03-07 09:54  ZhangZhihuiAAA  阅读(37)  评论(0编辑  收藏  举报