Welcome to the Backend Python Repository. This repository contains a series of subfolders that cover different aspects of Python programming, particularly focusing on variable annotations and asynchronous programming.
This repository is structured into three main subfolders, each focusing on a specific topic within Python programming:
- Variable Annotations: Learn how to use type hints and annotations to make your code more readable and maintainable.
- Asynchronous Functions: Understand the basics of asynchronous programming using
asyncio
. - Asynchronous Comprehensions: Dive deeper into asynchronous programming with async generators and comprehensions.
This folder introduces Python variable annotations, which help in specifying the type of variables for better code clarity and debugging.
- 0-add.py: Function to add two floating-point numbers.
- 1-concat.py: Function to concatenate two strings.
- 100-safe_first_element.py: Function to safely get the first element of a sequence.
- 101-safely_get_value.py: Function to safely retrieve a value from a dictionary.
- 102-type_checking.py: Function demonstrating the use of
mypy
for type checking. - 2-floor.py: Function to return the floor of a floating-point number.
- 3-to_str.py: Function to convert a float to a string.
- 4-define_variables.py: Demonstrates how to define variables with type annotations.
- 5-sum_list.py: Function to sum a list of floats.
- 6-sum_mixed_list.py: Function to sum a mixed list of integers and floats.
- 7-to_kv.py: Function to return a tuple.
- 8-make_multiplier.py: Function to return a function that multiplies a float by a given multiplier.
- 9-element_length.py: Function to return a list of tuples with the element and its length.
- README.md: Documentation for the variable annotations project.
This folder focuses on the basics of asynchronous programming using Python's asyncio
module.
- 0-basic_async_syntax.py: Basic async function demonstrating the use of
await
. - 1-concurrent_coroutines.py: Running multiple coroutines concurrently.
- 2-measure_runtime.py: Measuring the runtime of concurrent coroutines.
- 3-tasks.py: Creating and managing tasks with
asyncio
. - 4-tasks.py: Another example of managing tasks.
- README.md: Documentation for the async functions project.
This folder covers asynchronous comprehensions and async generators.
- 0-async_generator.py: An async generator that yields random numbers.
- 1-async_comprehension.py: Async comprehension to collect random numbers.
- 2-measure_runtime.py: Measure runtime for async comprehensions running in parallel.
- README.md: Documentation for the async comprehensions project.
To get started with this repository, ensure you have Python 3.7 or higher installed. You can clone this repository and navigate to each folder to run the individual scripts. Here's how you can clone the repository:
git clone https://github.com/kc-clintone/alx-backend_python.git
cd alx-backend_python
Here are some useful resources to learn more about the topics covered in this repository:
- Python Type Hints
- Python asyncio Documentation
- Real Python: Python Type Checking
- Real Python: AsyncIO
This repository serves as a comprehensive guide to understanding Python's variable annotations and asynchronous programming features. Each folder is self-contained with examples and scripts to help you grasp the concepts easily. Happy coding!