0% found this document useful (0 votes)
43 views

Introduction To Computer Programming

This document provides an introduction to computer programming and the Python programming language. It discusses how computers need to be programmed to perform tasks, and how programming languages provide instructions to computers. It then describes programming languages, compilers, interpreters, and gives an overview of the Python programming language, how it is used, getting started with Python, and writing a basic Python program.

Uploaded by

Nyan Linn Htet
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
43 views

Introduction To Computer Programming

This document provides an introduction to computer programming and the Python programming language. It discusses how computers need to be programmed to perform tasks, and how programming languages provide instructions to computers. It then describes programming languages, compilers, interpreters, and gives an overview of the Python programming language, how it is used, getting started with Python, and writing a basic Python program.

Uploaded by

Nyan Linn Htet
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 18

INTRODUCTION TO COMPUTER

PROGRAMMING
COMPUTER

A computer can do many things with its


• high computing power and
• large memory

But, it needs to be programmed to perform a specific


task or solve a certain problem.
PROGRAMMING

Programming is telling a computer what to do.

01010111011010
Hey computer, do
00011000010111
something!
010000111111
PROGRAMMING LANGUAGES

• A programming language is a set of vocabulary and grammatical rules for


instructing a computer or computing device.
• Each has a unique set of keywords that it understands and a special syntax
for organizing instructions.
SYNTAX SEMANTIC AND PRAGMATIC

• Syntax : the structure or grammar of the language (How to construct a valid


sentence?)

• Semantic : the meaning of the sentence (What does a sentence mean?)

• Pragmatic : the right usage of the language (How the language is used?)
LANGUAGE HIERARCHY

High Level Language

Assembly Language

Machine Language

Computer Hardware
HIGH LEVEL PROGRAMMING LANGUAGES

• Human readable
• Used by developers to create
software and applications across
various platforms
• Can’t be understood by the machine
directly
COMPILER AND INTERPRETER

Programs written in high level languages must be translated into a format the
computer can understand (machine code) before they can be run.

There are two primary ways:


• Compiling
• Interpreting
COMPILER

A program that reads source code Can do optimizations


and produces a stand-alone
executable program
Need to be run only once
INTERPRETER

• A program that directly execute the source code


• Need to interpret every time the program is run
• More flexible than compilers but less efficient
INTRODUCTION

• Created by Guido van Rossum


• High level, interpreted language
• Multiple programming paradigms (OOP, functional programming)
• Two major versions (Python 2 and Python 3) not compatible with each other
• Free, open-source, portable and platform independent
• Simplicity, readability, fast development
IS USED

• Game development

• Web development

• Software development

• Raspberry Pi

• AI and machine learning


GETTING STARTED

Being an interpreted language, the python interpreter is necessary. Open the


command prompt and try typing “python” and press “Enter”.
If it results as the following, python is already installed.

If not, you need to install python first!


You can get the installer from https://www.python.org/downloads/, the
python official website.
Run the installer! You will see the following window.
INTERACTIVE MODE

• Good for learning, testing and exploring new things.


• Cannot save the statements written.
• You can get into this mode with the command “python” and quit with “Ctrl+Z”
• Three options:
• python –c command
• python –m module
• python –i filename
IDE

• IDE (Integrated Development Environment) is a software application that


provides comprehensive facilities to programmers.
• An IDE normally consists of a source code editor and build automation tools
• There are many IDEs to develop python. (Eclipse with PyDev, spyder, VScode,
sublime text, pycharm, etc.)
• You can also use IDLE already installed together with python.
PYTHON SYNTAX

• A line is considered terminated with newline character.

• Block of codes are written with indentation.

• Comments are written with “#” prefix.


WRITING A PYTHON FILE

• Python files have extension “.py”.


Create a new file and type “print(‘Hello World’)” then save as “hello.py”.

• A python file can be run from –


• IDE
• Command prompt

You might also like