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