By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
431,852 Members | 2,123 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 431,852 IT Pros & Developers. It's quick & easy.

help me with classMaker

shahram555
P: 4
I have seen this code in a book.according to this book,as we run code and type 'classMaker()' will see this:
>>> classMaker()
making the class
do you want to make an object of the class?
-------------
and then we answer:yes,

>>>classMaker()
making the class
do you want to make an object of the class?
yes
object made
your name is Raman
--------------------
I don't understand how to enter 'yes'.what should I do?Do I write 'yes' after '....of the class?'?
I did that but It failed
Expand|Select|Wrap|Line Numbers
  1. def classMaker(flag=True):
  2.  if flag:
  3.   print('making the class')
  4.   class MyName:
  5.   name='Raman'
  6.   print('do you want to make an object of the class?')
  7.   answer=input()
  8.  if answer=='yes':
  9.   my_object=MyName()
  10.   print('object made')
  11.   print('your name is',my_object.name)
Aug 23 '14 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.