0% found this document useful (0 votes)
59 views4 pages

01 Chapter One - Get Started

Uploaded by

Bemnet Girma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
59 views4 pages

01 Chapter One - Get Started

Uploaded by

Bemnet Girma
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Machine Learning from Scratch with Python, Scikit-Learn & PyTorch by Bemnet Girma

CHAPTER ONE

Get Started

Objectives

What is programming?
What is programming language?
How computers understand a programming language?
How to write and run a code?

keyboard_arrow_down Lesson One : Introduction to Programming


Computers are dumb. Computers are only smart because we program them to be.

What is Programming?

Programming is the process of preparing an instructional program for a device to do some task
without making mistakes.

There are two types of languages for communication between a computer and a programmer
(human).

1. Machine language: which is a binary code (series of 0s and 1s) and computers understood it and
it is difficult for humans to understand.

2. Programming language: which is a source code and humans understood it and computers could
not.

What is Programming Language?

A programming language is a formal language, which includes a set of instructions that helps a
programmer to communicate or interact with a computer.
Programming Language is classified into two categories, based on the level (Degree) of abstraction
and gap between source code and machine code.

1. Source code is any collection of code, written using a human-readable programming language,
usually as plain text.

2. Machine code is a computer program written in machine language instructions that can be
executed directly by a computer's control unit.

High-level language Vs low-level language

High level programming languages are those which are programmer friendly. Humans can easily
understand it which helps in easy maintaining and debugging of the code.

Examples – Java, C, C++, Python

Low level programming languages are those which are machine friendly. Humans can’t understand
such languages. In other words, low level languages are not human readable.

Examples – Assembly language, Machine language.

PS. Computers only understand machine code.

keyboard_arrow_down Lesson Two : Compiler and Interpreter


What is Compiler?
A compiler is a computer program that translates source code written in one programming language
(the source language) into another language (the target language) to create an executable program.

What is Interpreter?
An interpreter is a computer program that directly executes instructions written in a programming
language, without requiring them previously to have been compiled into a machine language
program.

Compiler Vs Interpreter
All the programming languages are converted to machine understandable language for execution.
The conversion is taken care of by compilers and interpreters.

A compiler takes the source code and converts it into machine executable code at once. The
processor takes the executable and executes it. The languages which use a compiler are called
compiled languages. Compiled languages are faster and more efficient comparatively.
Examples – Java, C++

An interpreter is one which runs the code line by line and executes instruction by instruction. The
languages which use interpreters are called Interpreted languages. Such languages are slower in
terms of execution and less efficient.

💡 Suppose you want to watch an Italian movie, but you don't understand the Italian language.
However, you can understand English. You have two options to watch the movie. The first way is to
watch an English dubbed version of the movie, if available. The second way is to watch the Italian
movie with English subtitles. In the second way, the subtitles are displayed scene by scene
separately, whereas in the first way, all the scenes are converted to English. We can compare the
first scenario with a compiler and the second one with an interpreter.

Examples – PHP, Python, Ruby

keyboard_arrow_down Lesson Three : How to write and run a code?


How to write a code?
To write and execute a python program on our computer we need to install two basic Application
softwares called Editor (IDE) and compiler on our computer. The editor is used to write our source
code and compiler used to compile and execute our source code. There are many editors and
compilers available for Python programming. You need to download any one. But here we use
Jupyter Notebook as an IDE.

What is IDE?
IDE (Integrated Development Environment) is a place (graphic interface) to write, run, and debug
(check errors) code and also convert your source code to machine code.

Examples: Visual Studio, IDLE, PyCharm, Jupyter Notebook


How to run (execute) a code?
You can’t simply type rubbish in an IDE, convert it to machine code and expect the computer to
understand it. Each programming language has its own set of rules (Grammar) you must follow
within an IDE called Syntax.

What is Syntax?
Syntax is set of rules you must follow to run your program correctly. Syntax for each programming
language is unique.

PS. Breaking programming rules will result in an error.

Example:
Mens clothes are cheap.
Men’s clothes are cheap

Key Takeaways

Programming is the process of preparing an error-free program for a device.


A programming language is a formal language to communicate with a computer through
instructions.
Programming languages are translated to machine-readable language by compilers and
interpreters.
Compiler is a program that translates code written in one programming language into a
language that a computer can understand and execute.
Interpreter is a program that directly executes code written in a programming language
without prior translation into a machine-readable form.
To write and execute a python program on our computer we need to install IDE and compiler.
IDE is a graphic interface to write, run, debug and also convert code to machine code.
Syntax is set of rules you must follow to run your program correctly.

// END OF CHAPTER ONE

Click here for Chapter Two

You might also like