Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #111614 > unrolled thread
| Started by | Eric kago <erikkago@gmail.com> |
|---|---|
| First post | 2016-07-18 12:50 +0300 |
| Last post | 2016-07-20 02:31 +1000 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Request for help Eric kago <erikkago@gmail.com> - 2016-07-18 12:50 +0300
Re: Request for help Steven D'Aprano <steve@pearwood.info> - 2016-07-20 02:31 +1000
| From | Eric kago <erikkago@gmail.com> |
|---|---|
| Date | 2016-07-18 12:50 +0300 |
| Subject | Re: Request for help |
| Message-ID | <mailman.79.1468868404.2307.python-list@python.org> |
Hi Pythoners I need help in understanding hoe to put up the code to the following command - Create a constructor that takes in an integer and assigns this to a `balance` property Regards, Eric Kago +254(0)714249373 Nairobi Kenya
[toc] | [next] | [standalone]
| From | Steven D'Aprano <steve@pearwood.info> |
|---|---|
| Date | 2016-07-20 02:31 +1000 |
| Message-ID | <578e55f9$0$1583$c3e8da3$5496439d@news.astraweb.com> |
| In reply to | #111614 |
On Mon, 18 Jul 2016 07:50 pm, Eric kago wrote:
> Hi Pythoners
>
> I need help in understanding hoe to put up the code to the following
> command
Hi Eric,
You might find that the "Tutor" mailing list is better for simple questions
like this:
https://mail.python.org/mailman/listinfo/tutor
Remember, for help with home work, show the code you already have.
> - Create a constructor that takes in an integer and assigns this to a
> `balance` property
Talking about a "constructor" means that you need to have a class. We define
a class with the "class" keyword:
class Myclass:
pass
To give it a constructor method, you need to use the __init__ method, or
sometimes __new__. In this case, I think __init__ is what you want. Do you
know how to define methods inside a class?
Remember that __init__ is spelled with TWO underscores at the start and end.
--
Steven
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web