self.age = age ... more stack exchange communities company blog Stack Exchange Inbox Reputation and Badges sign up log in tour help Tour Start here for a quick overview of the site Help Center Detailed A word for acting in advance of some expected or anticipated outcome Should two DFAs be complete before making an intersection of them? Join them; it only takes a minute: Sign up invalid syntax when create a instance of class up vote 1 down vote favorite I run that code in python shell 3.3.2, http://caribtechsxm.com/invalid-syntax/python-function-definition-syntax-error.php
Browse other questions tagged python syntax or ask your own question. If it is so, then it is not an answer but a comment. –Freakyuser Jun 5 '13 at 4:49 add a comment| Your Answer draft saved draft discarded Sign up How can I Improve gameplay for new players, as a new player? asked 3 years ago viewed 3636 times active 3 years ago Blog Stack Overflow Podcast #92 - The Guerilla Guide to Interviewing Related 145In Python, what is the difference between '/' http://stackoverflow.com/questions/17941891/class-instance-declaration-syntax-error-in-python
Because their IDLE can get very buggy... –TerryA Jun 5 '13 at 4:33 @Haidro the code is from Codecademy, but I run it in my Python IDLE(download from the What stops messenger RNA from binding to itself? The body of your methods is indented correctly, but you forgot to indent the doc string, and the def statement for your methods, in addition to the is_alive = True statement. Why do units (from physics) behave like numbers?
self.name = name ... Are illegal immigrants more likely to commit crimes? How can a nine tailed fox catch its prey? Why would breathing pure oxygen be a bad idea?
Getting Coveo configured properly in a CD/CM server setup Unix Exit Command How should I prepare myself for a more supervisory role? Invalid Syntax Python Def Can I use my client's GPL software? Really thx!! –Sayakiss Jun 5 '13 at 4:31 add a comment| up vote -1 down vote I test the following code, and it works well. #!/usr/bin/python class Animal(object): is_alive = True Read More Here current community chat Stack Overflow Meta Stack Overflow your communities Sign up or log in to customize your list.
def __init__(self, name, age): ... share|improve this answer edited Jun 5 '13 at 4:36 answered Jun 5 '13 at 4:30 Burhan Khalid 88.5k1091147 Wow! Half the pentagon! print(self.name) ...
You are right!! check my blog screen cut in IDLE: python syntax share|improve this question edited Jun 5 '13 at 8:26 Burhan Khalid 88.5k1091147 asked Jun 5 '13 at 4:16 Sayakiss 2,9951649 Your code works Teaching a blind student MATLAB programming How to tell where file is going to be saved? Steepest descent/gradient descent as dynamical system Help me remember which is which: "humoro" and "humuro" Why does a full moon seem uniformly bright from earth, shouldn't it be dimmer at the
ideone.com/PSdx8P –Ashwini Chaudhary Jun 5 '13 at 4:18 I have tried your code and there is no error. –zhangyangyu Jun 5 '13 at 4:24 Is this in Hotel cancellation from booking.com Why do neural network researchers care about epochs? Thanks in advance. this content Can anyone give me some advice?
class Animal(object): """Makes cute animals.""" is_alive = True def __init__(self, name, age): self.name = name self.age = age def description(self): print (self.name) print (self.age) hippo = Animal("2312",21)#error occurs in that line Have fun learning from codecademy :). –TerryA Jun 5 '13 at 4:35 | show 1 more comment 2 Answers 2 active oldest votes up vote 2 down vote accepted You didn't Not the answer you're looking for?
is_alive = True ... If you type it in IDLE like this, it will work: >>> class Animal(object): ... """Makes cute animals.""" ...