Introduction of Python
Getting Started with Python
Syntax in Python
Comment in Python
Variables in Python
Data Types in Python
Numbers in Python
Castings in Python
Strings in Python
Boolean in Python
Operators in Python
List in Python
Tuples in Python
Sets in Python
Dictionary in Python
if Else Statement in Python
While Loop in Python
For Loop in Python
Functions in Python
Lamba Function in Python
Arrays in Python
Classes and Objects in Python
Inheritance in Python
Iterators in Python
Scope in Python
Modules in Python
Dates in Python
Math in Python
JSON in Python
RegEx in Python
Try and Except in Python
User Input in Python
String Formatting in Python
Python Syntax Execution
Python me kisi bhi code ko execute karne ke 2 tarike hain. Pahla aap command prompt/IDLE ka use kariye ya fir direct .py extension ke sath file banakar use run kariye. Chaliye IDLE ka use karke Syntax dekhte hain…
>>> print(“Hello”)
Hello
>>>
Python Indentation Kya hota hai?
Python me Indentation ka bahut bada role hota hai. Dekha jaye to indention ek space ke alawa kuch bhi nhi h lekin python ke case me ispar dhyan dena bhut hi important hota hai. Indentation kisi bhi line of code ke pahle ka space hota h. Chaliye hum isse example ke sath samjhege.
Example 1 :
if (8> 4):
print(“8 is greater than 4”)
Example 2 :
if (8> 4):
print(“8 is greater than 4”)
Upar diye gaye dono examples me se Example 2 “Right” and Example 1 “Wrong” hai. Aisa issliye kyuki “print” ke pahle indentation hona bahut jaruri hai. Ek Indentation keyboard ke tab space ke barabar hota hai.
Agar aapne C, C++, Java ya inki tarah kisi aur languages me kam kiya hai to aap isse aisa samajhiye ki jaise hum kisi bhi loop me curly braces ka use karte hain usi tarah python me Indentation ka concept hota hai, bas fark itna hai ki hume dusre languages me opening braces aur closing braces ka achi tarah se dhyan dena padta hai lekin Python ke Indentation ke concept ne isse easy kar diya hai.