[Tutor] Some error that you may find funny but I can't fix.

Alan Gauld alan.gauld at btinternet.com
Sat Jan 9 20:09:26 EST 2016


On 09/01/16 19:49, Lawrence Lorenzo wrote:

> 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.

Can you post in plain text please?
Otherwise all your code gets messed up making it
impossible to guess what might be wrong.

> RE: [Tutor] Some error that you may find funny but I can't fix.Lawrence Lorenzo  16:35 To: Steven D'Aprano> Date: Sun, 10 Jan 2016 00:59:18 +1100> From: steve at pearwood.info> To: tutor at python.org> CC: mcshizney at hotmail.co.uk> Subject: Re: [Tutor] Some error that you may find funny but I can't fix.> > Hi Lawrence, and welcome!> > > On Sat, Jan 09, 2016 at 01:17:55PM +0000, Lawrence Lorenzo wrote:> > > > 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.> > Unfortunately you seem to have forgotten to inc
>  lude the code or error. > Assuming your code is not too big (say, no more than one or two > hundred lines), please copy and paste both the code and the full error > into the body of your email.> > P
>  lease make sure you turn off "Rich Text" or HTML mail, as that often > messes up the code and makes it really hard to understand.> > Thanks,> > > -- > Stevenimport 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 = 500while (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 = in


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




More information about the Tutor mailing list