<分区>
所以每当我运行这个程序时,我都会收到一个语法错误,内容如下: 文件“dice.py”,第 17 行 def 骰子(骰子数量): ^ SyntaxError: 语法无效
程序如下:
# dice.py
# written for python 3.4
# by Will Jones
import os
import platform
import random
opSys = platform.system()
if opSys == "Windows":
system.os("cls")
else:
system.os("clear")
print("This program gives you a number based on 1 or more dice rolls\n")
diceAmount = eval(input("Enter an amount of dice to roll")
def dice(diceAmount):
rolls = diceAmount
while rolls > 0
rolls = rolls - 1
dieRoll = random.randint(0,6)
sum = 0 + dieRoll
print("The number is:", sum)
def main():
pie = 4
dice(diceAmount)
input("Enter any key to quit")
system.os("exit")
main()
我很想知道为什么它不让我定义一个该死的函数。呃...所以,唉,我来找你寻求帮助。