Nicholas Harman wrote:
class Television(object):
#Contstructor
Spelling error: Constructor.
Actually, technically __init__ is not the constructor. __init__ is the
initializer, as the object has already been created before __init__ is called.
__new__ is the constructor, although in this case it is unused.
def __init__(self, name, channel = 1, volume = 5):
Optional: it is the usual convention to declare default values without a
space, that is, __init__(self, name, channel=1, volume=5).
def main():
tv_name = input("What do you want to call your television? ")
Are you using Python 2, or Python 3?
If Python 3, this is fine. But in Python 2, you should use raw_input instead
of input.
tv = Television(tv_name)
choice = None
while choice != "0":
print \
("""
TV Maker
0 - Quit
1 - Television Details
2 - Set Channel
3 - Set Volume
4 - Chanage the name of the TV
""")
Spelling: Change, not Chanage.
The rest seems fine to me, assuming you are writing for beginners.
--
Steven
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor