84669 person learning
152542 person learning
20005 person learning
5487 person learning
7821 person learning
359900 person learning
3350 person learning
180660 person learning
48569 person learning
18603 person learning
40936 person learning
1549 person learning
1183 person learning
32909 person learning
学习是最好的投资!
Same as upstairs, usedic
dic
def get_option(): return "逗你玩" def find_score(): pass def add_score(): pass def sub_tract_score(): pass def kic(): pass def blacklist(): pass def main(op): op_dic = { "查积分": find_score, "加积分": add_score, "减积分": sub_tract_score, "踢人": kic, "黑名单": blacklist, } op = op_dic.get(op) if op: return op() else: print("查无此令") if __name__ == "__main__": option = get_option() main(option)
Use dict ?
actions_d = { '查积分': findScore, '加积分': addScore, '减积分': subtractScore, '踢人': kick, '设置谁为黑名单': blacklist, } actions_d.get(action, default_action)()
Same as upstairs, use
dic
Use dict ?