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