PYTHON:TypeError:DriverSpeed()获取0个位置参数,但给出了1

时间:2016-03-08 05:15:40

标签: python

干草嘲笑我是编程的新手,有人请求帮助我,我需要解决这个问题,但我看到的每个地方我都不明白人们在说什么......有人请求告诉我我需要做什么,这是我正在处理的Python代码......

def SpeedLimit ():
    SpeedLimet = int(input("Enter Speed Limit: "))
    return SpeedLimet

def DriverSpeed ():
    DriverSpeed = int(input("Enter Driver Speed: "))
    return DriverSpeed

def OverOrUnderSpeedLimit (number):
    UnderSpeedLimet = False
    if DriverSpeed(number) < int(50) ==0:
        OverSpeedLimet = True
    return SpeedLimet

def OverSpeedLimit (result):
    if result == True:
        print("You Are Over The Speed Limit")
    else:
        print("You Are On/Under Speed Limit")

def DemeritPoints ():
    DemeritPointsGained = DriverSpeed - SpeedLimit

#Main Program
SpeedLimit()
DriverSpeed()
OverOrUnderSpeedLimit("number")
OverSpeedLimit("result")
DemeritPoints()

我正在尝试做一些会问......

"what is the speed limit"

"what speed is the car going"

...然后我想让它向我展示你将获得多少速度积分 e.g。

"You don't loose any Demerit points"
or
"You loose [number] meany Demerit points"

感谢您的帮助:D

1 个答案:

答案 0 :(得分:-1)

def DriverSpeed (): # No parameters here...
    DriverSpeed = int(input("Enter Driver Speed: "))
    return DriverSpeed

def OverOrUnderSpeedLimit (number):
    UnderSpeedLimet = False
    if DriverSpeed(number) < int(50) ==0: # you gave it a parameter here...
        OverSpeedLimet = True
    return SpeedLimet