python 24点算数

来源:互联网 发布:贝克汉姆 知乎 编辑:程序博客网 时间:2024/05/23 18:01

一直想用已有的皮毛知识做24点算数,苦于没思路 难过

终极版是要加入开根号,幂次方,但现在连加减乘除的都还写不出来,先把这点存货记录在这里

# -*- coding: utf-8 -*-import mathoperators = ['+', '-', '*', '/', '√', '^']for op in operators:print opclass Calc24():# 根号def Rootof(self, value):print math.power(self.value)#幂次方def Powerof(self, value):print math.sqrt(self.value)def __init__(self, value):self.value = valueif __name__ == "__main__":store = Noneinput_lmiit = 10input_max = 4for i in range(input_max):print istore[i] = input("please input: ")for j in store:print j


原创粉丝点击