Introduction to Python

Python is a general-purpose object-oriented programming language. Python was developed by Guido van Rossum in early 1990's at the National Research Institute for Mathematics and Computer Science in the Netherlands.

Python is a high-level programming language that is widely used for web development, data analysis, artificial intelligence, scientific computing, and more.

Python Features:
  • Easy to learn and use
  • Interpreted language
  • A broad standard library
  • Interactive mode
  • Databases
  • GUI Programming
Python Applications:
  • Web Development
  • Data Analysis
  • Artificial Intelligence
  • Scientific Computing
  • Game Development
  • Automation
Comments:

Comments are used to explain code and make it more readable. In Python, comments start with the # symbol and continue to the end of the line. Python does not support multi-line comments, so each line that needs to be commented must start with the # symbol.

Mode of Execution:

Python code can be executed in two modes: interactive mode and script mode. In interactive mode, you can type Python commands directly into the Python interpreter and see the results immediately. In script mode, you write your Python code in a file with a .py extension and run it using the Python interpreter.

Python Identifiers:

Python identifiers are names given to variables, functions, classes, and other objects in Python. An identifier must start with a letter (a-z, A-Z) or an underscore (_), followed by any number of letters, digits (0-9), or underscores.

Data Types:

Python has several built-in data types:

  • Text Type: str
  • Numeric Types: int, float, complex
  • Sequence Types: list, tuple, range
  • Mapping Type: dict
  • Set Types: set, frozenset
  • Boolean Type: bool
  • Binary Types: bytes, bytearray, memoryview
Keywords:

Keywords are reserved words in Python that have special meanings and cannot be used as identifiers. Some of the keywords in Python include:

and as assert break
class continue def del
elif else except exec
finally for from global
if import in is
lambda nonlocal not or
pass raise return try
while with yield