From 14c0617e8b8c67b47fe47589831d64faeefbb48b Mon Sep 17 00:00:00 2001 From: Akhileswar Date: Fri, 24 Oct 2025 23:40:38 +0530 Subject: [PATCH] updated files --- 46_Generators.py | 3 ++- 47_Yield.py | 4 ++-- 48_Import_Module.py | 13 +++++++------ 49_Virtul_env.py | 7 ++++--- 4 files changed, 15 insertions(+), 12 deletions(-) diff --git a/46_Generators.py b/46_Generators.py index f4f7d7d..7cb6c9c 100644 --- a/46_Generators.py +++ b/46_Generators.py @@ -1,4 +1,5 @@ -# A generator function is a special type of function that returns an iterator object. Instead of using return to send back a single value, generator functions use yield to produce a series of results over time. +"""A generator function is a special type of function that returns an iterator object. +Instead of using return to send back a single value, generator functions use yield to produce a series of results over time.""" def fun(max): cnt = 1 diff --git a/47_Yield.py b/47_Yield.py index eded744..b599389 100644 --- a/47_Yield.py +++ b/47_Yield.py @@ -1,11 +1,11 @@ -# yield Keyword -> In Python, yield keyword is used to create generators, which are special types of iterators that allow values to be produced lazily, one at a time, instead of returning them all at once. +"""Yield keyword is used to create generators, which are special types of iterators that allow values to be produced lazily, one at a time, instead of returning them all at once.""" # Syntax # def generator_function(): # yield value -# Examples of yield +"""Examples of yield""" # Example 1: Simple Generator to Yield Numbers Sequentially def fun(m): for i in range(m): diff --git a/48_Import_Module.py b/48_Import_Module.py index a5e2a71..727377f 100644 --- a/48_Import_Module.py +++ b/48_Import_Module.py @@ -1,5 +1,6 @@ -# Import module in Python -# In Python, modules help organize code into reusable files. They allow you to import and use functions, classes and variables from other scripts. +"""Import module in Python +In Python, modules help organize code into reusable files. +They allow you to import and use functions, classes and variables from other scripts.""" # Importing built-in Module import math @@ -7,11 +8,11 @@ print("Value of pi:", pie) +"""Importing External Modules +To use external modules, we need to install them first, we can easily install any external module using pip command in the terminal.""" -# Importing External Modules -# To use external modules, we need to install them first, we can easily install any external module using pip command in the terminal, for example: - -# pip install "module_name" +# Example +"""pip install pandas""" import pandas diff --git a/49_Virtul_env.py b/49_Virtul_env.py index ca32462..7ceddf4 100644 --- a/49_Virtul_env.py +++ b/49_Virtul_env.py @@ -1,7 +1,8 @@ -# A virtual environment is an isolated Python environment that allows you to manage dependencies for each project separately. It prevents conflicts between projects and avoids affecting the system-wide Python installation. +""" A virtual environment is an isolated Python environment that allows you to manage dependencies for each project separately. +It prevents conflicts between projects and avoids affecting the system-wide Python installation.""" -# How to Create a Virtual Environment in Python -# We use the virtualenv module to create isolated environments. It creates a folder with all necessary executables for the project. +"""How to Create a Virtual Environment in Python +We use the virtualenv module to create isolated environments. It creates a folder with all necessary executables for the project.""" # Step 1: Installing virtualenv """$ pip install virtualenv"""