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