[Tutor] Python error that you may find funny but I don't get. :)
Lawrence Lorenzo
mcshizney at hotmail.co.uk
Sat Jan 9 18:51:22 EST 2016
Hey, I am very new to the ways of python and am currently experiencing this error. This program is just a novice project set by my school to create an adventure game however I am having issues with being able to set skill points (500) to the users desired skills. Here is what I have done and the error it gives me in the email.
import randomimport timeimport math
#the player and NPC class.class char(object): #character attributes def __init__(self, name, health, attack, rng, magic, speed): self.name = name self.health = health self.attack = attack self.speed = rng self.magic = magic self.speed =speedskillpoints = 500print(" You have 500 skill points to spend on character development so use them wisely.")print("There are 5 skills ""health, attack, range, magic and speed"" which you can decide to spend sillpoints on.")print("Each skill has a weakness apart from speed which determines who attacks first in a battle and if you can flee.")print("You may want to enforce a single ability rather than have multiple weaker abilities.")print("note that melee beats range, range beats magic, magic beats melee. If you have the same skill points in 2 skills then you won't have a weakness.")time.sleep(1)
count = 500
while (count) > 0: name = input("Please enter a character name. ") health = int(input("Enter a number for the ammount of points you would like to designate to your characters health. Remember you only have 500 and have 5 skills to set. ")) (count) = count - health attack = int(input("Enter a number for the ammount of points you would like to designate to your characters attack. You only have ", count, " remaining and 4 skills to set. ")) (count) = count - attack rng = int(input("enter a number for the ammount of points you would like to designate to your characters range. You only have ", count, " remaining and 3 skills to set. ")) (count) = count - rng magic = int(input("enter a number for the ammount of points you would like to designate to your characters magic. You only have ", count," remaining and 2 skills to set ")) (count) = count - magic print ("Your character speed has been set at (", count, ")") speed = (count) (count) = 0
print ("" + name + "your health has been set to " (health))print ("" + name + "your attack has been set to " (attack))print ("" + name + "your range has been set to " (rng))print ("" + name + "your magic has been set to " (magic))print ("" + name + "your speed has been set to " (speed))
player = [()]
Traceback (most recent call last): File "C:\Users\mcshizney\Desktop\adventuregame.py", line 29, in <module> attack = int(input("Enter a number for the ammount of points you would like to designate to your characters attack. You only have ", count, " remaining and 4 skills to set. "))TypeError: input expected at most 1 arguments, got 3'
Code not done obviously however here is the error and code.
More information about the Tutor
mailing list