On 10/01/16 15:21, Lawrence Lorenzo wrote:
Please use plain text to send mail. Your formatting
makes the code unreadable.
Thankfully the error does all the work for us...
> 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
<snip for brevity...>
> The error is:
> You have 500 skill points to spend on character development so use them
> wisely....
> 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
As it says you can only have one argument to input.
You need to construct your prompt outside the call then use that:
prompt = "Enter a number for the amount of points you would like to
designate to your characters attack. You only have " + count +
" remaining and 4 skills to set."
attack = int(input(prompt))
or similar.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor