-1

所以我正在尝试为我的班级制作角色创建者 RPG,但我遇到了一个错误

#import modules
import random
#define variables
Strength = 0
Health = 0
Wisdom = 0
Dexterity = 0
Pool = 30
choice = None
#Welcome the Player
while choice != 0:
    print ("""
    Welcome to teh CharacterCreator program for RPG's
    What would you like to do?
    0 - Quit
    1 - Assign Point to Atrributes
    2 - Remove Points
    3 - Look at point values
       """);

    choice = input("Choice:")
    print()
    # exit

    if choice == "0":
        print("good-bye.")
    elif choice == "1":
         while Pool > 0:
              print(" You have ",Pool," points left.")
              #Ask which atrribute to chose
              print (""" What would you like to assign points to:
                    Dexterity(1)?
                    Strength(2)?
                    Health(3)?
                    Wisdom(4)?""")
              #assign actions
              pick = input("Choice(1-4):")
              if pick == 1:
                  added = int(input("How many points would you like to assign?")
                  Dexterity += added#I want to add the variable from up there but it give me a syntax error
                  Pool -= added

所以这给我带来了一些麻烦。我想将他们输入的值添加到之前定义的变量中,但这给了我一个语法错误。

4

1 回答 1

2

在靠近底部的这条线中:

added = int(input("How many points would you like to assign?")

您忘记在末尾添加第二个右括号。

于 2013-06-09T00:46:21.540 回答