Skip to main content

Flow of execution of a python program पाइथन प्रोग्राम के निष्पादन का प्रवाह

Flow of execution represents a general outline of Python program execution. The specific flow can vary based on the program's structure, control flow statements (if, else, for, while), and function calls.
निष्पादन का प्रवाह पायथन प्रोग्राम निष्पादन की एक सामान्य रूपरेखा का प्रतिनिधित्व करता है। विशिष्ट प्रवाह प्रोग्राम की संरचना, नियंत्रण प्रवाह विवरण (यदि, अन्यथा, के लिए, जबकि), और फ़ंक्शन कॉल के आधार पर भिन्न हो सकता है।

1.) Start: The program begins execution.
1.) प्रारंभ: प्रोग्राम का निष्पादन प्रारंभ होता है।

2.) Import Modules: If necessary, the program imports external modules or libraries.
2.) मॉड्यूल आयात करें: यदि आवश्यक हो, तो प्रोग्राम बाहरी मॉड्यूल या लाइब्रेरी आयात करता है।

3.) Define Functions: Any functions used in the program are defined.
3.) फंक्शन्स को परिभाषित करें: प्रोग्राम में उपयोग किए गए किसी भी फंक्शन को परिभाषित किया जाता है।

4.) Main Program: The main body of the program starts.
4.) मुख्य प्रोग्राम: प्रोग्राम का मुख्य भाग प्रारंभ होता है।

5.) Initialization: Variables and data structures are initialized.
5.) इनिशियलाइज़ेशन: वेरिएबल्स और डेटा स्ट्रक्चर्स को इनिशियलाइज़ किया जाता है।

6.) Statements: The program executes statements sequentially.
6.) स्टेटमेंट्स: प्रोग्राम स्टेटमेंट्स को क्रमिक रूप से निष्पादित करता है। 

7.) Control Flow Statements: If-else, for, or while statements are encountered, the flow of execution is altered based on conditions.
7.) नियंत्रण प्रवाह कथन: यदि अन्यथा, के लिए, या जब कथन सामने आते हैं, तो शर्तों के आधार पर निष्पादन का प्रवाह बदल दिया जाता है। 

8.) Function Calls: Functions are called if needed, and their execution is handled.
8.) फंक्शन कॉल्स: जरूरत पड़ने पर फंक्शन्स को कॉल किया जाता है और उनके निष्पादन को संभाला जाता है।

9.) Output: Results are printed or displayed.
9.) आउटपुट: परिणाम मुद्रित या प्रदर्शित किए जाते हैं।

10.) End: The program terminates.
10.) समाप्ति: कार्यक्रम समाप्त होता है।

This is a simplified representation, and the actual flow can be more complex depending on the specific program logic. It can be extended to include Error handling like try-except blocks, Recursion, OOP mechanisms etc.
यह एक सरलीकृत प्रतिनिधित्व है, और विशिष्ट प्रोग्राम तर्क के आधार पर वास्तविक प्रवाह अधिक जटिल हो सकता है। इसे त्रुटि प्रबंधन जैसे ट्राई-एक्सेप्ट ब्लॉक, रिकर्सन, ऊप तंत्र आदि को शामिल करने के लिए बढ़ाया जा सकता है।
Example :-
#add two numbers

def add(a, b):
return a + b
result = add(5, 10)
print(result)

Comments

Popular posts from this blog

Filter function of python

filter function:-  Imagine we have a bunch of things, like a list of numbers, a collection of fruits, or any other group of items. Now, let's say we want to pick out only certain items from that group based on a specific condition. This is where the filter function comes in handy. Let's say we have a list of numbers, and we want to filter out only the even numbers. We define a condition-checking function that checks if a number is even. Then, we pass this function and the list of numbers to the filter function. It goes through each number, applies the condition-checking function, and keeps only the numbers that are even. Finally, it gives us a new list containing only the even numbers. def is_even(num):     return num % 2 == 0 numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] filtered_numbers = list(filter(is_even, numbers)) print(filtered_numbers) Output [2, 4, 6, 8, 10] We can also utilize lambda expressions to define filtering conditions directly within the filter function. nu...

The Python Interpreter पायथन इंटरप्रेटर

The Python interpreter is a program that executes Python code. It reads and interprets Python scripts or interactive commands, converting them into machine-readable bytecode for the computer to execute.The interpreter is a crucial component for running Python code, facilitating both learning and development processes. Users can interact with the interpreter in two primary modes: पायथन इंटरप्रेटर एक प्रोग्राम है जो पायथन कोड को निष्पादित करता है। यह पायथन स्क्रिप्ट या इंटरैक्टिव कमांड को पढ़ता है और व्याख्या करता है, उन्हें कंप्यूटर द्वारा निष्पादित करने के लिए मशीन-पठनीय बाइटकोड में परिवर्तित करता है। दुभाषिया पायथन कोड चलाने के लिए एक महत्वपूर्ण घटक है, जो सीखने और विकास दोनों प्रक्रियाओं को सुविधाजनक बनाता है। उपयोगकर्ता इंटरप्रेटर के साथ दो प्राथमिक मोड में बातचीत कर सकते हैं:- 1. Interactive Mode:- In this mode we can launch the Python interpreter in our terminal or command prompt without specifying a script.This mode allows us to enter Python commands and see immediate results...

Lambda Function of Python पायथन में लैम्ब्डा फ़ंक्शंस

Lambda functions, also known as anonymous functions that are one-line functions without a name. They are defined using the lambda keyword and are primarily used when a small function is required for a short period. Lambda functions can take any number of arguments but can only have a single expression. लैम्ब्डा फ़ंक्शंस, जिन्हें अनाम फ़ंक्शंस के रूप में भी जाना जाता है, जो बिना नाम के एक-पंक्ति फ़ंक्शंस हैं। उन्हें लैम्ब्डा कीवर्ड का उपयोग करके परिभाषित किया गया है और मुख्य रूप से तब उपयोग किया जाता है जब छोटी अवधि के लिए एक छोटे फ़ंक्शन की आवश्यकता होती है। लैम्ब्डा फ़ंक्शंस किसी भी संख्या में तर्क ले सकते हैं लेकिन केवल एक ही अभिव्यक्ति हो सकती है। Syntax:- lambda arguments: expression Example:- double = lambda x: x * 2 print(double(5))  #Output=10 sum = lambda a, b: a + b print(sum(3, 4))  #Output=7