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
答案 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