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