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