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