Level 1 : What happens here?


import asyncio

async def main():
    print("A")
    await asyncio.sleep(0)
    print("B")

asyncio.run(main())

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