小编Bil*_*der的帖子

TypeError:__ init __()需要3个参数(给定2个)

我在这里看到了一些关于我的错误的答案,但它没有帮助我.我是python上的一个绝对的菜鸟,并且刚刚在9月开始做这个代码.无论如何看看我的代码

class SimpleCounter():

    def __init__(self, startValue, firstValue):
        firstValue = startValue
        self.count = startValue

    def click(self):
        self.count += 1

    def getCount(self):
        return self.count

    def __str__(self):
        return 'The count is %d ' % (self.count)

    def reset(self):
        self.count += firstValue

a = SimpleCounter(5)
Run Code Online (Sandbox Code Playgroud)

这是我得到的错误

Traceback (most recent call last):
File "C:\Users\Bilal\Downloads\simplecounter.py", line 26, in <module>
a = SimpleCounter(5)
TypeError: __init__() takes exactly 3 arguments (2 given
Run Code Online (Sandbox Code Playgroud)

python arguments class

5
推荐指数
2
解决办法
4万
查看次数

Excel嵌套错误

我正在使用Excel 2013,我必须创建一个If语句,它基本上根据某个标记号选择学生的成绩(显然,需要嵌套)这是我创建的If语句:

=IF(E2<=20,"N",
IF(OR(E2>=21,E2<=25),4,
    IF(OR(E2>=26,E2<=32),"5C",
        IF(OR(E2>=33,E2<=38),"5B", 
            IF(OR(E2>=39, E2<=44), "5A", 
                IF(OR(E2>=45, E2<=53), "6C", 
                    IF(OR(E2>=54, E2<=61), "6B", 
                        IF(OR(E2>=62, E2<=71), "6A", 
                            IF(OR(E2>=72, E2<=87), "7C", 
                                IF(OR(E2>=88, E2<=103), "7B", 
                                    IF(OR(E2>=104, E2<=120), "7A")))))))))))
Run Code Online (Sandbox Code Playgroud)

我收到的错误是:

无法输入指定的公式,因为它使用的嵌套级别高于当前文件格式中允许的嵌套级别

我的问题是,如何缩短此声明以允许Excel使用它?

excel if-statement nested

1
推荐指数
1
解决办法
1万
查看次数

标签 统计

arguments ×1

class ×1

excel ×1

if-statement ×1

nested ×1

python ×1