Log in to comment.

No comments yet.

Share
Understand __init__ concept in Python

Understand __init__ concept in Python

Understand __init__ concept in Python

Understand __init__ concept in Python

Today learns an interesting quiz on Python "class" concept, share with you, see below code block and guess what is the output:

class Fruit:
    def __init__(self):
        print('1')

class Apple(Fruit):
    def __init__(self):
        print('2')

obj1 = Apple()

======

Choice can be: (1) 1, (2) 2, or (3) 1 2

Learn "Scientific Programming using Python", knowledge is discussed in Chapter 8