Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 15

INTRODUCTION TO

PYTHON PRGRAMMING
What is Programming?
 The art of telling a computer how to perform
complex tasks
 The art of writing computer programs (software)
 Program is a set of instructions asking the
computer to perform specified tasks
Course Learning Objectives (CLOs)

 Describe the fundamental programming constructs


and articulate how they are used to develop
computer programs
 Develop programs to implement computer-based
solutions of well specified problems
 Distinguish the advantages and limitations resulting
from the use of different language constructs that
embody similar programming concepts
Textbook
Reference Books / Resources
 Introduction to Computation and
Programming Using Python, John V. Guttag,
The MIT Press
 Practical Programming, An Introduction to
Computer Science Using Python 3, 2nd Edition,
Paul Gries, Jennifer Campbell, Jason Montojo

 http://www.py4inf.com/
 https://www.tutorialspoint.com/python/index.htm
 https://realpython.com/
What is a Programming Language?

 A systematic set of rules used to write instructions


that can be translated into machine language and
then executed by a computer
 Programming languages can be used to create
programs that control the behavior of a machine
and/or to express algorithms precisely
Types of Programming Languages (1/2)

 Machine Languages
 Strings of numbers giving machine specific instructions
 Example: 00000001 00000010 00000001
 Assembly Languages
 English-like abbreviations representing elementary
computer operations (translated via assemblers)
 Example:

LOAD BASEPAY
ADD OVERPAY
STORE GROSSPAY
Types of Programming Languages (2/2)

 High-level Languages
 Codes similar to everyday English
 Use mathematical notations
 Have to be translated to machine-level, thus taking
extra processing time
 Take less time to write, are shorter, easier to read, and
more likely to be correct
 Example:
grossPay = basePay + overTimePay
What is Code? Software? Program?

 A sequence of stored instructions


 It is a little piece of our intelligence in the
computer
 It is a little piece of our intelligence we can give to
others
 we figure something out and then we encode it and
then give it to someone else to save them the time and
energy of figuring it out
Python - The Programming Language

 A general-purpose interpreted, interactive, object-


oriented, and high-level programming language
 Created by Guido van Rossum during 1985- 1990
 Named after Monty Python
 Used by Google from the beginning
 The most popular language in 2021 as per an IEEE
survey along with old classics Java, C, and C++
 Instagram, YouTube, Reddit, Spotify, to name just a
few of the professional products built using Python
IEEE
Spectrum’s
Ranking of
Programmin
g Languages
in 2021
Why Python?
 Very easy, simple, natural, and readable
 Python 3 has 33 keywords, and Python 2 has 31. By
contrast, C++ has 62, Java has 53, and Visual Basic has
more than 120

 Python is a Beginner's Language


 Many other advantages that become obvious as we
learn more
Python Syntax compared to other programming

 Python was designed for readability, and has some


similarities to the English language with influence
from mathematics.
 Python uses new lines to complete a command, as
opposed to other programming languages which often
use semicolons or parentheses.
 Python relies on indentation, using whitespace, to
define scope; such as the scope of loops, functions
and classes. Other programming languages often use
curly-brackets for this purpose.
Variables in Python
 Variables in python as the
name suggests are the values
that vary.
 In a programming language, a
variable is a memory location
where you store a value.
 The value that you have stored
may change in the future
according to the
specifications.
Declaring Variables in Python

Python has no additional commands to declare a variable. As soon


as the value is assigned to it, the variable is declared.

There are a certain rules that we have to keep in mind while


declaring a variable:
 The variable name cannot start with a number. It can only start
with a character or an underscore.
 Variables in python are case sensitive.
 They can only contain alpha-numeric characters and underscores.
 No special characters are allowed.

1x = 10
2#variable is declared as the value 10 is assigned to it.

You might also like