Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #7254
| Path | csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!weretis.net!feeder1.news.weretis.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <nambo4jb@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.004 |
| X-Spam-Evidence | '*H*': 0.99; '*S*': 0.00; 'else:': 0.03; 'help?': 0.03; 'sys': 0.05; '__name__': 0.09; 'append': 0.09; 'callable': 0.09; 'def': 0.12; '"))': 0.16; '"__main__":': 0.16; '(0,': 0.16; '(self):': 0.16; 'subject:Objects': 0.16; 'subject:PLEASE': 0.16; 'wrong?': 0.23; 'code': 0.24; 'object': 0.26; 'message- id:@mail.gmail.com': 0.28; 'import': 0.29; 'subject:HELP': 0.29; 'class': 0.29; 'received:209.85.215': 0.30; 'received:209.85.215.46': 0.30; 'received:mail- ew0-f46.google.com': 0.30; 'typeerror:': 0.30; 'print': 0.31; 'done': 0.32; 'to:addr:python-list': 0.33; 'follows:': 0.34; 'skip:# 10': 0.34; 'received:google.com': 0.37; 'received:209.85': 0.37; 'but': 0.38; 'received:209': 0.39; 'list,': 0.39; 'to:addr:python.org': 0.39; 'getting': 0.40; 'format': 0.40; 'almost': 0.60; 'subject:, ': 0.60; 'below:': 0.79; 'dogs': 0.84; 'subject:Methods': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=QZDLIX/H5dnNpd2mRfA0RgJKF+HgWFFF6sHB23bAqEc=; b=ebkE7T5qzIIFi+iuw6vDzfvIe8TrG/ZSHjhkrs2zdrKcyRmikXUR3hExmYbrGu+HVv lur2kytbYSb0+i7kzkgwqodAtqys9LUEZ+JzrZjXlQIjNXDHmu9b/EbCtAsE426UyRm/ W2Gpw+l1C5erN/bKo/pwZ9dI6MjQi8nRCmPz8= |
| DomainKey-Signature | a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=nVR9As5/uc5n+ZhZBC98vnqSUvqhCcdaem2yCpEWJa577F8iPCXwXPNEbU+5kga5pt eu3x2dEXRwJ9L1XkH6VZmmkzcG9scXK9lDrvz3jL3+feOLMFyiwZB/2nwv10yQL7uzie CJdHKLFXxrEtEP+y55tglhySfG/d5AWHmAc2E= |
| MIME-Version | 1.0 |
| Date | Wed, 8 Jun 2011 15:09:30 -0500 |
| Subject | Of Functions, Objects, and Methods-I NEED HELP PLEASE |
| From | Cathy James <nambo4jb@gmail.com> |
| To | python-list@python.org |
| Content-Type | text/plain; charset=ISO-8859-1 |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.12 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.30.1307563778.11593.python-list@python.org> (permalink) |
| Lines | 48 |
| NNTP-Posting-Host | 82.94.164.166 |
| X-Trace | 1307563779 news.xs4all.nl 49044 [::ffff:82.94.164.166]:48272 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | x330-a1.tempe.blueboxinc.net comp.lang.python:7254 |
Show key headers only | View raw
I am almost there, but I need a little help:
I would like to
a) print my dogs in the format index. name: breed as follows:
0. Mimi:Poodle
1.Sunny: Beagle
2. Bunny: German Shepard
I am getting
(0, ('Mimi', 'Poodle')) . Mimi : Poodle instead-what have I done wrong?
b) I would like to append to my list, but my line dogs.dogAppend() is
giving a TypeError:
for i in enumerate (self.dogAppend()):
TypeError: 'list' object is not callable
Any help?
#MY CODE BELOW:
import sys
class Dog():
def __init__(self, name, breed):
self.name = name
self.breed = breed
def dogAppend(self):
self.dogAppend = []
self.dogAppend.append((self.name,self.breed))
return self.dogAppend
def display (self):
for i in enumerate (self.dogAppend()):
print (i,".", self.name, ": " + self.breed)
if __name__ == "__main__":
dogs = Dog(name=input (" Enter Dog Name: "), breed=input ("Enter
Dog Breed: "))
while not dogs:
print("Goodbye!!")
sys.exit()
else:
#dogs.dogAppend()
dogs.display()
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Of Functions, Objects, and Methods-I NEED HELP PLEASE Cathy James <nambo4jb@gmail.com> - 2011-06-08 15:09 -0500
Re: Of Functions, Objects, and Methods-I NEED HELP PLEASE John Gordon <gordon@panix.com> - 2011-06-08 20:42 +0000
Re: Of Functions, Objects, and Methods-I NEED HELP PLEASE Larry Hudson <orgnut@yahoo.com> - 2011-06-08 23:59 -0700
Re: Of Functions, Objects, and Methods-I NEED HELP PLEASE Ethan Furman <ethan@stoneleaf.us> - 2011-06-09 05:54 -0700
Re: Of Functions, Objects, and Methods-I NEED HELP PLEASE Ethan Furman <ethan@stoneleaf.us> - 2011-06-09 06:10 -0700
Re: Of Functions, Objects, and Methods-I NEED HELP PLEASE Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2011-06-09 10:25 -0700
Re: Of Functions, Objects, and Methods-I NEED HELP PLEASE Larry Hudson <orgnut@yahoo.com> - 2011-06-09 23:07 -0700
csiph-web