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