Skip to main content

Posts

Showing posts from 2025

Programming with Python Language Tutorial available in hindi and english पाइथन प्रोग्रामिंग टुटोरिअल हिंदी एवं अंग्रेजी भाषा में

 Unit -01 1. Introduction to python (पाइथन भाषा का परिचय) 2. History of Python Programming Language पाइथन प्रोग्रामिंग लैंग्वेज का इतिहास 3. Python Programming Language’s Features and Advantages पायथन प्रोग्रामिंग लैंग्वेज की प्रमुख विशेषताएं 4. Python’s Programming Language's Popularity पाइथन प्रोग्रामिंग लैंग्वेज की लोकप्रियता 5.The Future of Python Programming Language पायथन प्रोग्रामिंग लैंग्वेज का भविष्य 6. The Python Interpreter पायथन इंटरप्रेटर 7. The Python IDLE पाइथन आईडीएलई 8. Installation process of Python IDLE पायथन आईडीएलई की इंस्टालेशन प्रक्रिया 9. Dynamically typed and strongly typed features of python गतिशील रूप से टाइप और दृढ़ता से टाइप की गई भाषा पायथन 10. Basic Data Types of Python पायथन के बेसिक डेटा टाइप 11. Variables in python पायथन में वेरिएबल 12. Expressions in Python पायथन में अभिव्यक्तियां 13. Statements in Python पायथन में कथन 14. Operator's in Python पायथन में ऑपरेटर्स 15. Flow of execution of a python program पाइथन प्रोग्राम के निष्पादन का प्रवाह 16...

Inbuilt Functions in Python पाइथन में अंतर्निहित फ़ंक्शन्स

Python is a powerful programming language that provides many inbuilt functions to make coding simple and efficient. These functions help programmers perform common tasks like finding length, converting characters, or checking memory addresses without writing extra code. पायथन एक शक्तिशाली प्रोग्रामिंग भाषा है जो कई अंतर्निहित (inbuilt) फ़ंक्शन्स प्रदान करती है, जिससे कोडिंग आसान और प्रभावी हो जाती है। ये फ़ंक्शन प्रोग्रामर को सामान्य कार्य करने में मदद करते हैं जैसे लंबाई निकालना, अक्षरों का रूपांतरण करना या मेमोरी एड्रेस जांचना, और इसके लिए अतिरिक्त कोड लिखने की आवश्यकता नहीं होती। (a)  id()  – Unique Identifier of an Object  किसी वस्तु का अद्वितीय पहचानकर्ता The  id()  function returns the unique memory address of an object. Every variable or object in Python is stored in memory, and  id()  helps us know where exactly it is stored. id()  फ़ंक्शन किसी ऑब्जेक्ट का अद्वितीय मेमोरी एड्रेस लौटाता है। पायथन में हर वेरिएबल या ऑब्जेक्ट मेमोरी में संग्रह...

Shallow Copy and Deep Copy in Python पायथन में गहरी प्रतिलिपि और उथली प्रतिलिपि

In Python, the concepts of deep copy and shallow copy refer to how data structures, like lists, are duplicated. पायथन में, गहरी प्रतिलिपि और उथली प्रतिलिपि की अवधारणाएं संदर्भित करती हैं कि कैसे डेटा संरचनाएं, जैसे सूचियां डुप्लिकेट की जाती हैं। 1.) Shallow Copy  उथली प्रतिलिपि  :-   A shallow copy in Python creates a new object, but instead of creating copies of nested objects, it copies references to those objects. This means that if the original object is modified, changes to nested objects will reflect in both the original and the shallow copy. पायथन में एक उथली प्रतिलिपि एक नई वस्तु बनाती है, लेकिन नेस्टेड वस्तुओं की प्रतियां बनाने के बजाय, यह उन वस्तुओं के संदर्भों की प्रतिलिपि बनाती है। इसका मतलब यह है कि यदि मूल वस्तु को संशोधित किया जाता है, तो नेस्टेड वस्तुओं में परिवर्तन मूल और उथली प्रतिलिपि दोनों में दिखाई देंगे। You can create a shallow copy of a list using Slicing, copy method and copy module:- आप स्लाइसिंग, कॉपी विधि और कॉपी मॉड्यूल का उपयोग करके किसी सूची...

Set in Python पायथन में सेट, Set Operations सेट ऑपरेशन , Set Functions and Methods सेट फंक्शन एवं मेथड

In Python, a set is an unordered collection of unique elements. Sets are useful when we need to eliminate duplicates and perform common set operations like unions, intersections, and differences. We can create a set by using curly braces {} or the set() function but we cannot create an empty set using {}, as it creates an empty dictionary. Instead, we can use set(). पायथन में, एक सेट अद्वितीय तत्वों का एक अव्यवस्थित संग्रह है। सेट तब उपयोगी होते हैं जब हमें डुप्लिकेट को खत्म करने और यूनियनों, इंटरसेक्शन और अंतर जैसे सामान्य सेट ऑपरेशन करने की आवश्यकता होती है। हम कर्ली ब्रेसिज़ {} या set() फ़ंक्शन का उपयोग करके एक सेट बना सकते हैं लेकिन हम {} का उपयोग करके एक खाली सेट नहीं बना सकते, क्योंकि यह एक खाली डिक्शनरी बनाता है। इसके स्थान पर हम set() का उपयोग कर सकते है। Creating a Set सेट तैयार करना :- my_set = {1, 2, 3} # Using the set() function ( set() फ़ंक्शन का उपयोग करना ) my_set2 = set([1, 2, 3, 4, 5]) Set Operations/Methods सेट ऑपरेशन/ मेथड:-   1. Union (| or union()):-  Retu...

Dictionary in Python पायथन में डिक्शनरी, Dictionary Operations डिक्शनरी ऑपरेशन , Dictionary functions and methods डिक्शनरी फंक्शन और विधियाँ

In Python, a dictionary is a collection of key-value pairs. Dictionaries are useful for storing and managing data that is organized by a unique identifier or "key," such as names and values associated with them. Dictionaries in Python are mutable, efficient, and suitable for a variety of operations, especially for managing data with unique keys. पायथन में, एक शब्दकोश (डिक्शनरी) कुंजी-मूल्य युग्मों का एक संग्रह है। शब्दकोश डेटा को संग्रहीत करने और प्रबंधित करने के लिए उपयोगी होते हैं जो एक अद्वितीय पहचानकर्ता या "कुंजी" द्वारा व्यवस्थित होते हैं, जैसे कि उनके साथ जुड़े नाम और मान। पायथन में शब्दकोश परिवर्तनशील, कुशल और विभिन्न प्रकार के संचालन के लिए उपयुक्त हैं, विशेष रूप से अद्वितीय कुंजियों वाले डेटा को प्रबंधित करने के लिए। Syntax:- Creating a Dictionary  शब्दकोश तैयार करना :-  We can create a dictionary using curly braces {}  हम मंझला कोष्टक {} का उपयोग करके शब्दकोश बना सकते हैं my_dict = { "name": "Alice", "age": 25, "city...

List in Python पायथन में लिस्ट, List operations लिस्ट ऑपरेशन, List functions and methods लिस्ट फंक्शनस एवं मेथड्स

In Python, a list is a mutable, ordered collection of elements. Lists are one of the most commonly used data structures in Python because they can store elements of various data types and allow for flexible operations such as adding, removing, and modifying elements. Lists are defined by enclosing elements in square brackets [], with elements separated by commas. पायथन में, लिस्ट (सूची) तत्वों का एक परिवर्तनशील, क्रमबद्ध संग्रह है। पायथन में सूचियाँ सबसे अधिक इस्तेमाल की जाने वाली डेटा संरचनाओं में से एक हैं क्योंकि वे विभिन्न डेटा प्रकारों के तत्वों को संग्रहीत कर सकती हैं और तत्वों को जोड़ने, हटाने और संशोधित करने जैसे लचीले संचालन की अनुमति देती हैं। सूचियों को वर्गाकार कोष्ठकों [] में तत्वों को संलग्न करके परिभाषित किया जाता है, जिसमें तत्वों को अल्पविराम से अलग किया जाता है। Syntax:- # Creating a list लिस्ट तैयार करना  my_list = [1, 2, 3, "apple", [4, 5]] # Lists can be nested लिस्ट को नेस्ट किया जा सकता है  matrix = [[1, 2, 3], [4, 5, 6], [7, 8, 9]] print(matrix[1]) # O...

tuple in python पायथन में टपल, tuple operations टपल ऑपरेशन , tuple functions and methods टपल फ़ंक्शन और विधियाँ

In Python, a tuple is a collection of ordered, immutable elements. Tuples are similar to lists, but unlike lists, once a tuple is created, its elements cannot be changed. Tuples are defined by placing a sequence of elements separated by commas inside parentheses (). पायथन में, टपल क्रमबद्ध, अपरिवर्तनीय तत्वों का एक संग्रह है। टपल्स सूचियों के समान हैं, लेकिन सूचियों के विपरीत, एक बार टपल बन जाने के बाद, इसके तत्वों को बदला नहीं जा सकता है। टपल्स को कोष्ठक () के अंदर अल्पविराम द्वारा अलग किए गए तत्वों के अनुक्रम को रखकर परिभाषित किया गया है। # Creating a tuple टपल तैयार करना :- my_tuple = (1, 2, 3, "apple", [4, 5]) # Single-element tuple (note the trailing comma) एकल-तत्व टपल (अंतिम अल्पविराम पर ध्यान दें) single_element_tuple = (10,) # Tuples can be nested ट्पल्स को नेस्ट किया जा सकता है nested_tuple = (1, (2, 3), [4, 5]) tuple operations टपल ऑपरेशन:- 1. Concatenation जोड़ना:-  We can concatenate two or more tuples using the + operator. हम + ऑपरेटर का उपयोग करके दो या दो से अ...

String in Python पायथन में स्ट्रिंग, String Operations स्ट्रिंग ऑपरेशन, String Functions and Methods स्ट्रिंग फ़ंक्शन और विधियाँ

In Python, a string is an immutable sequence of characters. Strings are enclosed in either single quotes (`'`) or double quotes (`"`), and can also be enclosed in triple quotes for multi-line strings. एक स्ट्रिंग वर्णों का एक अपरिवर्तनीय अनुक्रम है। स्ट्रिंग्स सिंगल कोट्स (` `) या डबल कोट्स (`` ``) में संलग्न होती हैं, और मल्टी-लाइन स्ट्रिंग्स को ट्रिपल कोट्स ('''''') में संलग्न किया जा सकता है। Creating Strings स्ट्रिंग तैयार करना :- # Single and double-quoted strings s1 = 'Hello' s2 = "World" # Multi-line string with triple single and triple double quote:- s3 = '''This is a multi-line string.''' s4 = """This is also a multi-line string.""" String Operations स्ट्रिंग ऑपरेशन :- 1. Concatenation संयोजन:-  Combining two or more strings using the `+` operator. `+` ऑपरेटर का उपयोग करके दो या दो से अधिक स्ट्रिंग्स का संयोजन किया जा सकता है। s1 = 'Hello' s2 = 'World' s3 = ...

Basic python programs पाइथन के बेसिक प्रोग्राम

1.) Python program to print message "Hello, World!". print("Hello, World!") 2.) Python program to check if a Number is Even or Odd. num = int(input("Enter a number: ")) if num % 2 == 0:     print(f"{num} is an even number.") else:     print(f"{num} is an odd number.") 3.) Python program to find the Sum of Two Numbers. num1 = float(input("Enter the first number: ")) num2 = float(input("Enter the second number: ")) sum = num1 + num2 print(f"The sum of {num1} and {num2} is {sum}.") 4.) Python program to calculate Factorial of a Number. num = int(input("Enter a Positive Integer Number: ")) factorial = 1 if num < 0:     print("Factorial does not exist for negative numbers.") elif num == 0:     print("The factorial of 0 is 1.") else:     for i in range(1, num + 1):         factorial *= i     print(f"The factorial of {num} is {factorial}.") 5.) Python program for Simp...

in and not in keywords of Python पाइथन में इन एवं नॉट इन कीवर्ड

In Python, the keywords `in` and `not in` are used to check membership in sequences or collections, such as lists, tuples, strings, sets, or dictionaries. These keywords allow you to determine whether a specific value exists within a collection or not. पायथन में, कीवर्ड 'इन' और 'नॉट इन' का उपयोग अनुक्रमों या संग्रहों, जैसे सूचियों, टपल्स, स्ट्रिंग्स, सेट या शब्दकोशों में सदस्यता की जांच करने के लिए किया जाता है। ये कीवर्ड आपको यह निर्धारित करने की अनुमति देते हैं कि किसी संग्रह में कोई विशिष्ट मान उपस्थित है या नहीं। 1)`in` Keyword:- The `in` keyword is used to check if a value exists within a sequence or collection. `इन` कीवर्ड का उपयोग यह जांचने के लिए किया जाता है कि किसी अनुक्रम या संग्रह में कोई मान उपस्थित है या नहीं। If the `value` exists in the given `collection`, this expression returns `True`; otherwise, it returns `False`. यदि दिए गए `संग्रह` में `मान` उपस्थित है, तब यह अभिव्यक्ति `सही` लौटाती है; अन्यथा, यह 'गलत' लौटाता है। Syntax:- value in collecti...

break, continue, and pass in Python पायथन में, `ब्रेक`, ` कंटिन्यू`, और `पास`

In Python, `break`, `continue`, and `pass` are control flow statements used in for and while loops and conditional if-else. पायथन में, `ब्रेक`, ` कंटिन्यू`, और `पास` नियंत्रण प्रवाह के कथन हैं जिनका उपयोग फॉर और व्हाइल लूप और कंडीशनल इफ-एल्स में किया जाता है। 1.) break statement:- It Exits the loop immediately, regardless of the iteration count or condition. It is commonly used to stop a loop when a certain condition is met. 1.) ब्रेक स्टेटमेंट:- यह पुनरावृत्ति गणना या स्थिति की परवाह किए बिना तुरंत लूप को समाप्त कर देता है। इसका उपयोग आमतौर पर एक निश्चित शर्त पूरी होने पर लूप को रोकने के लिए किया जाता है। Syntax:-  break Example:- for i in range(5):   if i == 3:      break   print(i) Output:- 0 1 2 2.) continue statement:- It skips the rest of the code inside the loop for the current iteration and moves to the next iteration. It is Useful when we want to skip certain conditions in the loop but continue iterating. 2.) कंटिन्यू कथन: - यह वर्तमान पुनरावृत्ति ...

loop structure in python for loop and while loop पायथन में लूप संरचना फॉर लूप और व्हाइल लूप

A loop structure or iterative structure or repetitive structure in programming refers to a control flow mechanism that allows a set of instructions or code to be executed repeatedly based on a condition or over a collection of items. Loops help automate repetitive tasks and reduce redundancy in code. प्रोग्रामिंग में एक लूप संरचना या पुनरावृत्त संरचना या दोहराव संरचना एक नियंत्रण प्रवाह तंत्र को संदर्भित करती है जो किसी शर्त के आधार पर या वस्तुओं के संग्रह पर निर्देशों या कोड के एक सेट को बार-बार निष्पादित करने की अनुमति देती है। लूप्स दोहराए जाने वाले कार्यों को स्वचालित करने और कोड में अतिरेक को कम करने में मदद करते हैं। Key Components of a Loop Structure:- लूप संरचना के प्रमुख घटक:- A.) Initialization:- The starting point or value for the loop. ए.) इनिशियलाइज़ेशन:- लूप के लिए शुरुआती बिंदु या मान। B.) Condition:- The logical test that determines whether the loop should continue or stop. बी) स्थिति:- तार्किक परीक्षण जो यह निर्धारित करता है कि लूप जारी रहना चाहिए या बंद हो जाना चाहिए।...