Docsity

lecture notes about python programming language, Lecture notes of Computer science

Partial preview of the text

Download lecture notes about python programming language and more Lecture notes Computer science in PDF only on Docsity!

Python

Python

  • (^) Python is a widely used high-level programming language for general-purpose programming, created by Guido van Rossum and first released in 1991.

Why Use Python?

  • (^) It's powerful
  • (^) It's mixable
    • (^) Python can be linked to components written in other languages easily
  • (^) It's easy to use
  • (^) It's easy to learn
  • (^) Python is Interpreted
    • (^) Python is processed at runtime by the interpreter. You do not need to compile your program before executing it. This is similar to PERL and PHP.

Why Use Python?

  • (^) Easy-to-read
  • (^) Easy-to-maintain
  • (^) A broad standard library
  • (^) GUI Programming
  • (^) Script Mode Programming
  • (^) If instead you are working with more than a few lines of code
  • (^) ready to write an actual program, script mode is what you need.
  • (^) Instead of having to run one line or block of code at a time
  • (^) Let us write a simple Python program in a script. Python files have extension .py.
  • (^) Python Identifiers
  • (^) A Python identifier is a name used to identify a variable, function, class, module or other object.
  • (^) An identifier starts with a letter A to Z or a to z or an underscore (_) followed by zero or more letters, underscores and digits (0 to 9).
  • (^) Reserved Words (Key Words )
  • (^) Lines and Indentation
  • (^) Python provides no braces to indicate blocks of code for class and function definitions or flow control.
  • (^) Comments in Python
  • (^) A hash sign (#) that is not inside a string literal begins a comment.
  • (^) Assigning Values to Variables
  • (^) Python variables do not need explicit declaration to reserve memory space. The declaration happens automatically when you assign a value to a variable. The equal sign (=) is used to assign values to variables.
  • (^) Standard Data Types
  • (^) Python has five standard data types Numbers String List Tuple Dictionary
  • (^) Python - Basic Operators
  • (^) Types of Operator
    • (^) Arithmetic Operators
    • (^) Comparison (Relational) Operators
    • (^) Assignment Operators
    • (^) Logical Operators
  • (^) Python Comparison Operators
  • (^) Python Assignment Operators