Codewars note: Basic Mathematical Operations

My Codewars

exercis:

Solution:

def basic_op(operator, value1, value2):
    return eval(str(value1) + operator + str(value2))#math模块eval()执行字符串表达式

 

posted @ 2022-07-02 23:38  大序列  阅读(15)  评论(0编辑  收藏  举报