Level 1 : What will be printed?


class A:
    x = 10

a1 = A()
a2 = A()
A.x = 20
a1.x = 30
print(A.x, a1.x, a2.x)

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