All Basic Concept of Python
In this Blog I promised You Learned All of the Python Concept
Python is a High-level programming Language.It's also a case-sensitive language Python was also used in Artificial Intelligence and Machine Learning. Python was created bu Guido Van Rossum in 1970.
Why Python
Python is used for many reasons.
Automation: Python was a very good programming language for automation like the python automated various things like computers, or the Web.
Web Scrapping: Python was a very good programming language for Web scraping.
Backend: Python was very good Language for Backend like with the help of Django framework he give tools for write backend in python.
Aritificial Intelligence: Python is generally used for AI. Ex - ChatGpt was also AI Platform.
Machine Learning: Python was generally was used in Ml. Like python have various Libraries For ML.
Revolution of Python
Python was designed to be extensible and allow you to use it as an extension language for other modules and applications that need a programmable interface. It was created in the late 1980s and its implementation was started in 1989 by Guido Van Rossum.
Syntax
The syntax is a rule of write a code⭐
Hello World Program
print("Hello, World")
How to Declared Variable in Python
a = "This is a variable"
b = 10
DataTypes in Python
Text Type: |
|
Numeric Types: |
|
Sequence Types: |
|
Mapping Type: |
|
Set Types: |
|
Boolean Type: |
|
Binary Types: |
|
None Type: |
|
Getting the Data Type
You can get the data type of any object by using the type()
function:
a = 10
print(type(a)
x = "Hello World" | str | |
x = 20 | int | |
x = 20.5 | float | |
x = 1j | complex | |
x = ["apple", "banana", "cherry"] | list | |
x = ("apple", "banana", "cherry") | tuple | |
x = range(6) | range | |
x = {"name" : "John", "age" : 36} | dict | |
x = {"apple", "banana", "cherry"} | set | |
x = frozenset({"apple", "banana", "cherry"}) | frozenset | |
x = True | bool | |
x = b"Hello" | bytes | |
x = bytearray(5) | bytearray | |
x = memoryview(bytes(5)) | memoryview | |
x = None | NoneType |
Conditional Statements
If-else is two only statements are exist in python
If is used for set condition. Else is used for set condition was not True
user = "I Promised in this Blog you clear all Basic concept of Python"
if user == "I Promised in this Blog you clear all Basic concept of Python":
print(⭐)
else:
print("Read Again!")
Loop in Python
Python programming language provides the following types of loops to handle looping requirements. Python provides three ways for executing the loops. While all the ways provide similar basic functionality, they differ in their syntax and condition checking time.
While Loop in Python
Python For Loops
A for loop is used for iterating over a sequence (that is either a list, a tuple, a dictionary, a set, or a string).
This is less like the for keyword in other programming languages, and works more like an iterator method as found in other object-orientated programming languages.
With the for loop we can execute a set of statements, once for each item in a list, tuple, set etc.
Example
Print each fruit in a fruit list:
fruits = ["apple", "banana", "cherry"] for x in fruits: print(x)
The for loop does not require an indexing variable to set beforehand.
Looping Through a String
Even strings are iterable objects, they contain a sequence of characters:
Example
Loop through the letters in the word "banana":
for x in "banana": print(x)
The break Statement
With the break statement we can stop the loop before it has looped through all the items:
Example
Exit the loop when x
is "banana":
fruits = ["apple", "banana", "cherry"] for x in fruits: print(x) if x == "banana": break
Example
Exit the loop when x
is "banana", but this time the break comes before the print:
fruits = ["apple", "banana", "cherry"] for x in fruits: if x == "banana": break print(x)
All Basic are complete If you Learn Advanced python like class function Libraries of Python etc. Pls send me in Comments What You want.❤️