首页 > 解决方案 > 我没有在我的代码中要求一个参数,但它也说“all() 需要正好 1 个参数,0 给定”,我不知道我应该做什么

问题描述

class alphabet():
    def all():
        start=str(input('enter the alphabet you want to start with'))
        end=str(input('enter the alphabet you want to end with'))``
        for j in range (0,25):
            if start==chr(65+j):
            start=65+j
        for k in range(1,25):
            if end==chr(65+k):
                end=65+k
        for i in range (start,end):
            print(chr(i))
    
alphabet(all())

请尽快解决错误我正在尝试创建一个类“alphabets”,其中我定义了一个名为“all”的函数,它将在用户输入时写入字母

标签: pythonfunctionclassoop

解决方案


不要使用all. 它是一个内置的保留函数是python。重命名它。

这里


推荐阅读