Skip to main content
Brave Programmer Logo

BraveProgrammer

BraveProgrammer

HomeProjectsBlogsCoursesLessonsAbout

Site footer

BraveProgrammer

Free coding courses, practical tutorials, and real projects from BraveProgrammer. Learn web development with React, Next.js, and TypeScript.

Navigation

  • Home
  • Projects
  • Blogs
  • Courses

Resources

  • About
  • Lessons

© 2026 BraveProgrammer. All rights reserved.

  1. Courses
  2. /
  3. Python Fundamentals

Lesson 42 of 55 · Python

AsyncIO Basics

Duration: 20 minutes

AsyncIO Basics\n\nasyncio provides the building blocks for asynchronous, non‑blocking code using the async/await syntax. It shines for I/O‑bound workloads like network calls.\n\n```python\nimport asyncio\n\nasync def greet(name):\n await asyncio.sleep(1) # simulate async I/O\n return f'Hello, {name}!'

\nasync def main():\n messages = await asyncio.gather(greet('Alice'), greet('Bob'))\n for m in messages:\n print(m)\n\nasyncio.run(main())\n```\n\nThe event loop (asyncio.run) schedules coroutines and runs them concurrently.\n

Previous: Working with APIsNext: Concurrency with threading