[Tutor] Re: Program Questions (original) (raw)
Andrei project5 at redrival.net
Thu Jul 15 20:34:17 CEST 2004
- Previous message: [Tutor] Program Questions
- Next message: [Tutor] Program Questions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
mandy bowen wrote on Thu, 15 Jul 2004 17:25:11 +0000:
It tells me for the line: a = Account(1000.00) this constructor takes no arguments.
Here's an interactive session demonstrating what you did wrong (assuming that's the only error, I haven't read all your code):
class Account(object): ... def init(self, val): ... print val a = Account(4) 4 class Bccount(object): ... def init(self, val): ... print val b = Bccount(4) Traceback (most recent call last): File "", line 1, in ? TypeError: default new takes no parameters b = Bccount() b.init(4) 4
You've spelled init incorrectly. It's got TWO underscores on each side, but you've written a single one.
It also says for all of the "print" lines following the class call in MenuOption that "print" is invalid syntax.
print \n
And what is \n according to you? Right, it's nothing. \ is a line continuation character, n would be a non-existant variable which is put after a line continuation character - so you've got two errors. I presume you want to print an empty line (or two, to be precise). You do that by printing the string "\n":
print "\n"
-- Yours,
Andrei
===== Real contact info (decode with rot13): cebwrpg5 at jnanqbb.ay. Fcnz-serr! Cyrnfr qb abg hfr va choyvp cbfgf. V ernq gur yvfg, fb gurer'f ab arrq gb PP.
- Previous message: [Tutor] Program Questions
- Next message: [Tutor] Program Questions
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]