help me with classMaker

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shahram555
    New Member
    • Aug 2014
    • 4

    help me with classMaker

    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
    Code:
    def classMaker(flag=True):
     if flag:
      print('making the class')
      class MyName:
      name='Raman'
      print('do you want to make an object of the class?')
      answer=input()
     if answer=='yes':
      my_object=MyName()
      print('object made')
      print('your name is',my_object.name)
    Last edited by bvdet; Aug 30 '14, 12:09 PM. Reason: More descriptive title
Working...