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