Python Essentials Classroom Series – 24/Aug/2021

Why Python

  • By various means Python is
    • The fastest growing major programming language
    • Python can be used to develop
      • Command line/Terminal applications
      • Desktop Application
      • Web Applications
      • Most widely used language in AI/ML/Data Science
  • Python is a general-purpose high level language and its design makes it readable.
  • Python has a large number of reusable libraries called as packages developed.
  • Python standard installation is just around 27 mb.

Moment of Zen

  • Each computing language has its own style. Python has a bit of free verses that express python philosophy which are known as zen of python Preview

Python Development

  • Python is an open source project.
  • New features to the python are added. Python community, to add these new feature will look at PEP (Python Enhancement Proposal).
  • Refer Here

Python Interpreters

  • Python language has lot of interpreters
    • Python (CPython)
    • Jython
    • IronPython
    • Anaconda.
  • The version which is popular and which we have install in Python implemented in C (CPython)

Python Data: Types, Values, Variables and Names

  • Under the hood everything in your computer is a sequence of bits.
  • To solve the computing problems/business problems we would be building applications and to do this we need to deal with data of various sizes and types (number, text)
  • In python, every data is an object and object contains at least the following
    • A type
    • A unique id to distinguish it from objects
    • A value consistent with the type Preview
  • Lets look at some of the basic data types in python
Name Type Mutable Examples
Boolean bool no True, False
Integer int no 25,26, 11, 12
Floating point float no 3.14, 2.7e5
Complex complex no 3j, 3+4j
Text String str no ‘iphone’ "Android"
List list yes [‘ironman’, ‘thor’]
Tuple tuple no (2,5,6)
Bytes bytes no b’ab\xff’
ByteArray bytearray yes bytearray(..)
Set set yes set ([3,4,5])
FrozenSet frozenset no frozenset([‘test’, ‘develop’])
  • Mutable or immutable is whether the data value contained in the memory location can be changed (mutable) or not (immutable) Preview
  • In python variables are names not places.

Introduction to Python Interactive Interpreter

  • Launch any terminal (Powershell/Terminal) and type python and hit enter Preview
  • Interactive python will be open and here you can evaluate the python statements
  • This interactive python will do REPL (Read, Evaluate, Print, Loop)

Reserved Words

  • In any programming language, the compiler/interpreter reservers certain words, We cannot use the reserved words for naming varibles, functions, classes Preview

Variables

  • Python lets us define variables and since python is a dynamic language while defining variables, we need not specify types.
  • Depending on values passed to the variable, python interpreter will choose a type Preview

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

About learningthoughtsadmin