How does Programming Language work?
- At the hardware level, computers understand one language, called machine language also called object code.
About Python
- Python is a popular programming language.
- Created by Guido van Rossum.
- Released in 1991
You can use python:
- Web development (server-side),
- Software development,
- Mathematics,
- System scripting.
- Data Science
Text Editor used for python?
We can use Integrated Development Environment like:
Or You can Install Anaconda navigator Download
Basic Terms in Python
Syntax for Python:
- We use .py as extension
- Python Indentation is important.
- Variables in Python : We are assigning values
- Comments : we can use # tag or “””.
Variables
- Variables are containers for storing data values
- Python has no command for declaring a variable.
Variable Names Rules
- A variable name must start with a letter or the underscore character
- A variable name cannot start with a number
- A variable name can only contain alpha-numeric characters and underscores (A-z, 0-9, and _ )
- Variable names are case-sensitive (age, Age and AGE are three different variables)
Python Strings:
- Can use single quotation marks‘
- Can use Double quotation marks“
- You can display a string literal with the print() function:
Python Booleans:
- Booleans represent one of two values: True or False.
- When you compare two values, the expression is evaluated and Python returns the Boolean answer.
Almost any value is evaluated as True if it has some sort of content.
- Any string is True, except empty strings.
- Any number is True, except 0.
Any list, tuple, set, and dictionary is True, except empty ones.
Operators in Python
Python Lists:
- You can use lists to store multiple items in a single variable.
- Lists are created using square brackets:
Python Tuples:
- You can use Tuples to store multiple items in a single variable.
- A tuple is a collection which is ordered(defined order and that order will not change.) and unchangeable(we cannot change, add or remove items after the tuple has been created).
You can write Tuples with round brackets. ()
Python Sets:
- You can use Sets to store multiple items in a single variable.
- A set is a collection which is unordered, unchangeable*, and unindexed.
* Note: Set items are unchangeable, but you can remove items, add new items.
- Sets are written with curly brackets{}
- Sets cannot have two items with the same value.
Python Dictionaries:
- You can use Dictionaries to store data values in key: value pairs.
- A dictionary is a collection which is ordered*, changeable and does not allow duplicates.
- You can write Dictionaries with curly brackets{}, and have keys and values:
Python Range
Python If Else Loop:
Python While Loop
Python For Loops:
Python Function
Python Lambda Function
Python Recursion
Python Arrays:
Python Classes and Objects:
Python Inheritance:
Python Iterators:
Python JSON:
Python RegEx:
Python Pip:
For advanced python, you can refer below article.
Important 64 Libraries in Python