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
>>> 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)