[Tutor] defining functions and classes
Kann Vearasilp
vearasilp at gmail.com
Sat Jan 15 11:26:33 CET 2011
Do you also have to define the class attributes?
class Administrator():
name = ""
os = ""
def Skills(name,os):
name = raw_input('What is your name')
os = raw_input('What is your os')
self.name = name
self.os = os
Skills(name,os)
On Sat, Jan 15, 2011 at 11:10 AM, Brett Murch <brettmurch at gmail.com> wrote:
> Hi everyone,
>
> I'm just starting to learn Python and am starting by creating a text
> game but am having trouble with classes and funtions. I want to create a
> class or function where someone creates a charater and has a choice of
> their name or os. This is what I have so far;
>
> class Administrator():
> def Skills(name,os):
> name = raw_input('What is your name')
> os = raw_input('What is your os')
> self.name = name
> self.os = os
>
> Skills(name,os)
>
> I keep getting a syntax error on calling it. any ideas on what I'm doing
> wrong? Should it not be a class and should I just define it as a
> function or what?
>
> Thank you in advance
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110115/595b6619/attachment-0001.html>
More information about the Tutor
mailing list