1 Intro
1 Intro
2
Installing Python
• Python can be installed on Windows, Mac, and Linux operating systems.
• Download the latest version of Python from the official website:
https://www.python.org/downloads/
• Latest version is python 3.11
• Install Python by following the prompts in the installation wizard.
• You will need an IDE
• What is an IDE?
• Use Pycharm community version, you can download it from:
https://www.jetbrains.com/pycharm/download
3
Python is easy to lean
• Python is one of the easiest programming languages to learn
• You achieve more in Python per-statement than most
languages.
• The print() function is used to output text to the screen.
• Example: print("Hello, World!")
• Output: Hello, World!
• Python has its own style to make sure you code is clean and
readable
4
Programming language Syntax
• Just like any spoken language, programming languages have their own
syntax.
• What is a Syntax?
• A Set of words, symboles, and apperviations
• A Set of rules that govern the use of the the above to create valid sentances.
(Grammar)
• For a Python program to run correctly, it must have a valid syntax
5
Execute a Python code
• Python code can be executed directly in the command line
• If you have installed python, you can directly write and execute code
on the command line
• This way is useful to try and test small code portions
6
Execute a Python code
• You can execute a python file using the command line
• This way is more suitable for running store programs
7
Python code indentation
• Code indentation is used by Python to visually and syntactically
structure the program.
• A code indentation is the spaces at the beginning of the line code, it
can take one of the two styles:
• Tab
• 4 spaces
8
Python Data Types
• Data Types are basic
building blocks of a
program,
• They are used to
represent and store data
• Python has the following
built-in types:
9
Python Data Types
10
Python Operators: Arithmetic
11
Python Operators: Assignment
12
Python Operators: Comparison
13
Python Operators: Logical
14
Python Operators: Precendence Rules
15