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