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