Python Complete Tutorial: Python IDE, Data Types, Conditional Structure, String, Function, List और Tuple
आज के डिजिटल युग में programming सीखना एक बहुत महत्वपूर्ण skill बन चुका है। अगर आप coding की दुनिया में कदम रखना चाहते हैं तो Python programming language आपके लिए सबसे आसान और powerful विकल्प हो सकती है। Python की syntax बहुत simple होती है इसलिए beginners इसे आसानी से सीख सकते हैं। Python का उपयोग web development, automation, artificial intelligence, machine learning और data science जैसे कई क्षेत्रों में किया जाता है। इस article में हम Python के सभी basic concepts को detail में समझेंगे।
Python का Introduction
Python एक high-level और interpreted programming language है जिसे 1991 में Guido van Rossum ने बनाया था। Python open-source language है जिसका मतलब है कि इसे कोई भी free में उपयोग कर सकता है। Python की सबसे बड़ी खासियत इसकी readability है यानी इसका code आसानी से समझ में आ जाता है।
Python IDE क्या होता है
IDE का मतलब Integrated Development Environment होता है। यह एक ऐसा software होता है जिसमें programmer code लिखता है, run करता है और errors को debug करता है।
- IDLE (Python का default IDE)
- PyCharm
- Visual Studio Code
- Jupyter Notebook
Python Installing कैसे करें
- Python की official website python.org पर जाएँ
- Download Python option पर क्लिक करें
- Installer file download करें
- Add Python to PATH option select करें
- Install Now पर क्लिक करें
Running Simple Python Program
# Example 1
print("Hello World")
# Example 2
print("Welcome to Python Programming")
Python Dictionary और Traversing
# Example 3
student = {"name":"Rahul","age":20}
print(student)
# Example 4
for key,value in student.items():
print(key,value)
Removing Keys
# Example 5 del student["age"] print(student)
Data Types in Python
- Integer
- Float
- String
- Boolean
- List
- Tuple
- Dictionary
# Example 6 a = 10 b = 5.5 name = "Amit" status = True
Variable Declaration Rules
- Variable letter या underscore से शुरू होना चाहिए
- Variable number से start नहीं हो सकता
- Special symbols allowed नहीं होते
# Example 7 age = 21 name = "Ravi"
Python Identifier और Reserved Words
Identifier variables और functions के नाम होते हैं। Reserved words Python के special keywords होते हैं जैसे:
# Example 8 if, else, while, for, break, continue, pass
Input Output Function
# Example 9
name = input("Enter your name: ")
print("Hello",name)
Operators in Python
# Example 10 a = 10 b = 5 print(a + b)
# Example 11 print(a > b)
Advanced Python Operators
Membership Operator
# Example 12 list1 = [1,2,3,4] print(2 in list1)
Identity Operator
# Example 13 a = 10 b = 10 print(a is b)
Comments in Python
# Example 14 # This is a comment
Line और Indentation
# Example 15
if 5 > 2:
print("Five is greater")
Conditional Structure
If Statement
# Example 16
age = 18
if age >= 18:
print("You can vote")
If Else Statement
# Example 17
age = 16
if age >= 18:
print("Adult")
else:
print("Minor")
Nested If
# Example 18
age = 25
if age >= 18:
if age < 60:
print("Adult")
If Elif Else Ladder
# Example 19
marks = 80
if marks >= 90:
print("Grade A")
elif marks >= 60:
print("Grade B")
else:
print("Grade C")
Loop Control Structure
While Loop
# Example 20
i = 1
while i <= 5:
print(i)
i += 1
For Loop
# Example 21
for i in range(5):
print(i)
Nested Loop
# Example 22
for i in range(3):
for j in range(3):
print(i,j)
Break Statement
# Example 23
for i in range(10):
if i == 5:
break
print(i)
Continue Statement
# Example 24
for i in range(5):
if i == 2:
continue
print(i)
Pass Statement
# Example 25
for i in range(5):
pass
String Basics
# Example 26 text = "Python Programming" print(text)
Accessing String
# Example 27 print(text[0])
Updating String
# Example 28 text = "Hello Python"
Built in String Methods
# Example 29 name = "python" print(name.upper()) print(name.capitalize())
Functions in Python
# Example 30
def greet():
print("Hello Python")
greet()
Function Argument
# Example 31
def add(a,b):
return a+b
print(add(5,3))
Anonymous Function
# Example 32 square = lambda x: x*x print(square(5))
Python List
# Example 33 numbers = [10,20,30] print(numbers[0])
# Example 34 numbers.append(40) numbers.remove(20)
Python Tuple
# Example 35 data = (10,20,30) print(data[1])
# Example 36 print(len(data))
Practical 6, 7 और 8
Practical 6: User से input लेकर number positive या negative check करना
num = int(input("Enter number:"))
if num > 0:
print("Positive")
else:
print("Negative")
Practical 7: For loop से 1 से 10 तक numbers print करना
for i in range(1,11):
print(i)
Practical 8: Function बनाकर दो numbers का sum निकालना
def sum(a,b):
print(a+b)
sum(4,6)
Internal Links
FAQ
Python beginners के लिए क्यों अच्छा है?
Python की syntax simple और readable होती है इसलिए beginners इसे जल्दी सीख सकते हैं।
Python का उपयोग किन क्षेत्रों में होता है?
Python का उपयोग web development, automation, data science, AI और machine learning में किया जाता है।
Python सीखने में कितना समय लगता है?
अगर आप रोज practice करते हैं तो Python basics 20 से 30 दिनों में सीखे जा सकते हैं।
Conclusion
इस article में हमने Python programming के सभी basic topics जैसे Python introduction, installing python, data types, variables, operators, conditional statements, loops, string, functions, list और tuple को विस्तार से समझा। Python एक powerful और beginner friendly programming language है।
इसी तरह की useful programming और education related जानकारी के लिए हमारी वेबसाइट पर नियमित रूप से visit करते रहें।
