Level 10 : What will be printed?


class Counter:
    def __init__(self):
        self.value = 0
    def __call__(self):
        self.value += 1
        return self.value

c = Counter()
print(c(), c(), c())

Author: VenuEmmela | Tags: objects | 1859+ Python FAQs | Share
integer | list-methods-and-slicing | choice | creating-custom-modules | data-structures | array | call | collections | async | data-structure | class-decorators | deep-copy | complex | string-method | boolean-masking | operand | print-statement | comment | datatype | working-with-file-paths | logical-operators | sets | strings | identifier | math | lambda-functions | basic | descriptors | list-slicing | string | odd-number | data-structure | single-inheritance | sorting | attribute | pep | staticmethod | logical-operation | polymorphism | handling-missing-values-(fillna,-dropna) | aggregating-data-with-functools.reduce() | dicts | sorted | swapping | lambda | head-and-tail | sys | assert | managing-directories-with-os-and-shutil | thread | recurssion | defining-functions | min-function | identity-operator | using-yield-in-functions | input | counter-function | overriding-methods | methods | reading:-read(),-readline(),-readlines() | using-join()-and-is_alive()-methods | identity-operators-(is,-is-not) | matrix-list-comprehension | module | int | interpreter | assignment-operators | working-with-binary-files-(rb,-wb) | anchors-(^,-$) | print | decorator | iterator | string-slicing | access-modifier | slicing | working-with-temporary-files-using-tempfile | match | inherit | intering | inheritance | built-in-function | generator | time-series-with-pandas | map-function | library | directory-operations | floating-point-precision | regular-expressions | min-max-function | built-in-function | namespace | matrix | immutable-data-type | bitwise-operator | multithreading | update | debugging | comparison | tuple-unpacking | bitwise | touples | error-handling | working-with-dates-and-times | membership-operators-(in,-not-in) | complex-number | list-comprehension | string-formatting | function | shallow-copy | list-mutation | class-and-inheritance | __init_subclass__ | precedence | package-management | string-concatenation | destructor | math-copysign | arithmetic-expression | using-map()-for-transformations | formatting-with-strftime | classes | built-in | matplotlib | rollback | mutable | writing:-write(),-writelines() | nested-loop | conditional-statement | asyncio | benefit | data-type-conversions | list-indexing | binary-operation | list-join | frozenset | boolean-and-non-boolean | file-handling | file_handling | binary | python-module | introduction-to-python | logical-operator | file-handling | python-django | advanced-file-operations | design-principle | type_conversion | dataframe-and-series-objects | function-and-scope | escape-operator | else-statement | for | type-conversion-and-casting | list,-set,-and-dictionary-comprehensions | random | multiple-inheritance | exponentiation | list-operation | context-manager | comprehension | exception-handling | functions | operators | default-mutable-argument | using-the-threading-module | gil | filter-function | generators-in-python | data-type | tuple | encoding | python-repl | fabs-function | center | collection | quantifiers-(*,-+,-?,-{}) | conditional-statement | type-conversion | class-and-object | conversion | functional-programming | arithmetic-operation | append | while-else-loop | loops | pickling--unpickling | string-method | global-variable | raise-statement | formal-and-actual-parameter | feature | loop | control-flow | decimal | stack | expression | python-syntax-and-structure | lists | multiple-except-blocks | sum() | overflow | turtle | namedtuple | error | unit-testing | class-and-instance-variable | random-function | format | factorial-function | exception-handling | command-line-parsing | built-in-modules | asyncio-module | file | input-function | syntaxerror | postfix | functional-programming | yield | list-comprehension | __future__ | opening-files-(open()) | parameter | goto-function | objects | version-check | pass | floats | memory-management | encapsulation | import-method | zip | conditional-statements | threading | typeerror | python_version | why-use-multiprocessing-over-threading?-(gil) | datetime.date,-datetime.time,-datetime.datetime | operator-and | thread-synchronization | data_structure | syntax-error | using-assertions-(assertequal,-assertraises) | heap-memory | docstring | control-statement | arbitrary-arguments-(*args,-**kwargs) | bitwise-operator | id-function | using-os-and-pathlib-modules | boolean | enumerate() | mathematics | installation | round-function | indexing:-loc-vs-iloc | tuple-methods | regular-expression | lambdas | __all__-attribute | class | string-iteration | max-min | using-lists-as-stacks | expand-tab | version | immutability | operator-or | difference-between-threads-and-processes | virtual-environment | precedence-and-associativity | application | slice | tuples | method-overloading | multiple-inheritance | static-method | zfill-function | python | magic-method | filtering-and-indexing | joining-and-merging-dataframes | list-method | booleans | oops | dictionary-methods | round | string-slicing | identity-operator | loop-control | test-discovery | def | exception | scientific-notation | python-history | string-methods | software-design | dictionaries | syntax | dictionary | memory | oop | condition | operator | mysql | list-comprehensions | name-mangling | syntax-error | lambda-function | control-flow | iterable | key-value-pairs | loop-control-statements | literal-characters-and-special-characters | sys-module | list-vs-tuple | pandas | data-structures-in-python | numpy | split | method | recursion | mapping-function | compute | constructor | range | list | datetime | operations | counter | dictionary-comprehensions | regex | data-types | keyword | error-handling | creating-and-starting-threads | introduction-to-multiprocessing | global | using-else-and-finally | data-type | generators | copy | assignment-operator | return-statement | higher-order-function | mathematical-function | pseudocode | virtual-environment | multiprocessing | input-function | global-keyword | default-arguments | init | set-operation | string-formatting | indentation | else | implementation | iterators | indexing | global-variable | zip-function | join | filter | function-argument | invalid-list | sorting-and-ranking | object-attribute | while-loop | string-manipulation | integers | reading-and-writing-large-files-efficiently | numeric | thread-safe-data-structures-(queue.queue) | introduction-to-threads | statement | parsing-with-strptime | type-conversion | with-statement | operator-overloading | variable | python-operators | reading-and-writing-files | set | while-and-for-loop | sum-function | raise | while-loops | logical-operator | walking-through-directories-using-os.walk() ...