4. Programs and Programming Languages
▸ Programs are created using programming languages to control
behaviors and output of a computer through accurate algorithms.
▸ Programming Languages
▸ Machine Language.
▸ Assembly Language.
▸ High-Level Language - More like human language.
▸ Python
▸ Java
▸ GoLang
▸ C++
step by step instruction
to solve a problem
6. A machine-learning system is trained rather than explicitly
programmed. It’s presented with many examples relevant to a task,
and it finds statistical structure in these examples that eventually
allows the system to come up with rules for automating the task.
NEW APPROACH TO SOLVE PROBLEM
MACHINE LEARNING
8. Program Lifecycle - C++
▸ Editing the Code - Using text editor or IDE
▸ PreProcessing
▸ Compile
▸ Link
▸ Load
▸ Execute
Depend on runtime system and
execution model of the language
9. Python Program Lifecycle
▸ Behind the scene
.py Python
Compiler
.pyc Python VM
Interpreter
Python byte-codes loaded into Python Runtime
and interpreted by Python Virtual Machine
Byte-code is lower level and
p l a t f o r m i n d e p e n d e n t
presentation of your source code
10. Building Block of Programming Language
▸ Sequence
▸ The code will run by computer in order - from top to bottom
▸ Decision or Selection - If
▸ The execution of some code only when some condition is true.
▸ Loop or Iteration - For/While
▸ The execution of some code while some condition is true.
11. Setting Up Your Programming Environment
▸ Python Versions
▸ Python 2 or 3
▸ IDE
▸ PyCharm: A full-fledged IDE
▸ Atom/Sublime and …
▸ Visual Studio Code
▸ You can use any text editor that you like and save your program
with .py extension.
We use -> Python 3.8 and PyCharm 2020
myCode.py
12. Setup Development Environment
▸ Install Python Interpreter for your Platform (Windows/Mac/Linux)
▸ www.python.org
▸ Add python to your system PATH environment variable
▸ An environment variable is a dynamic named value that can affect the way
running process will behave on a computer.
▸ Install PyCharm
▸ Community
▸ Professional
You can also set PYTHONHOME
13.
14. Test Development Environment
▸ Open Terminal (CMD in Windows or Terminal in Linux/MAC OS)
▸ python3 - - version
Python
Version
15. Hello World Project
▸ Open PyCharm.
▸ Create New Project.
▸ Select Pure Python.
▸ Set Location and Name.
▸ Example: CS.QIAU-Python.
▸ Right-Click in Project Folder and Select “New” and Select “Python File”
▸ Set file name.
▸ Example: main.py
▸ Write Code in main.py
▸ Run the Code and Check the output.
26. Break Down the Hello World Program - Simpler Version
▸ Comments - line 1..6
▸ Define main() method - line 9
▸ create welcome_message variable - line 10
▸ call print() method - line 11..13
▸ Check special variable __name__ ==“__main__”
▸ This line of code is the entry point to your program.
▸ Call main() method - line 17
2 underscores