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