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