Basic Knowledge About Python

basic-knowledge-about-python

Overview Python

Python is High-level, interpreted, general purpose programing language and it released in 1991.Paython is also dynamically-typed and garbage-collected.

It is used for Web Development, Software Development, mathematics etc.

Founder Of Python
Guido van Rossum
Developer
Python Software Foundation
Launch In
20 February 1991 31 years ago
Operating System
Windows, macOS, Linux/UNIX, Android and more
Stable Release
3.10.6 / 2nd August 2022
Filename Extensions
.py, .pyi, .pyc, .pyd, .pyw, .pyz (since 3.5), .pyo (prior to 3.5)

Paradigm

Multi-paradigm, object-oriented, procedural (imperative), functional, structured, reflective
Latest version
Python 3.10. 0, documentation released on 4 October 2021. Python 3.9. 13, documentation released on 17 May 2022.

Python Features and Advantages

  • Easy code. Python is a very high-level programming language, and easy to use
  • Readable.
  • Free and Open-Source. 
  • Large Standard Library. 
  • Interpreted. 
  • Portable. 
  • Object-Oriented and Procedure-Oriented programing language
  • Extensible.

Disadvantages of Python

  • Slow Speed, Because Python is an interpreted language and dynamically-typed language. 
  • Less Occupies Memory. To provide simplicity to the developer, Python has to do a little tradeoff. 
  • Weak in Mobile Computing. 
  • Database Access. 
  • Compilation Errors.

Syntax

>>> print("Hello, World!")

Hello, World!

Data Type

Built-in Data Types In programming, data type is an important concept. Variables can store data of different types, and different types can do different things.

Python has the following data types built-in by default, in these categories

String Data Type
str
Numeric Data Type
int, float, complex
Sequence Data Type
list, tuple, range
Mapping Data Type
dictionary
Set Data Type
set,  froze set
Boolean Data Type
true/false
Binary Data Type
bytes, byte array, memory view
None Data Type
none

List:

Lists are used to store multiple items in a single variable.

Lists are one of 4 built-in data types in Python used to store collections of data, the other 3 are Tuple, Set, and Dictionary, all with different qualities and usage.

Lists are created using square brackets:

Example:-
//create a List:
thislist = ["apple", "banana", "cherry"]
print(thislist)

Tuple:

Tuples are used to store multiple items in a single variable.
Tuple is one of 4 built-in data types in Python used to store collections of data, the other 3 are List, Set, and Dictionary, all with different qualities and usage.
A tupleis store value in ordered and unchangeable. Tuples are written with round brackets.

Example:-
//create a Tuple:
thistuple = ("apple", "banana", "cherry")
print(thistuple)

Dictionary:

Dictionaries are used to store data values in key:value pairs.
A dictionary is a collection which is ordered*, changeable and do not allow duplicates.

Example:-
//create and print a dictionary:
thisdict = {
  "brand": "Ford",
  "model": "Mustang",
  "year": 1964
}
print(thisdict)


Python Exercise:

create variable and print:-
x = "Python"

y = "is"

z = "awesome"

print(x, y, z)

//output: python is awesome


create if and else statement:-
a = 33
b = 33
if b > a:
  print("b is greater than a")
elif a == b:
 print("a and b are equal")
//output: a and b are equal