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

Lecture Module 1 - Introduction

This document provides an overview of Module 1 of a basic Python programming lecture. It discusses the learning outcomes which include understanding Python's history, installing Python software, and writing Python code. It then covers topics like an introduction to Python, installation instructions, writing a first Python program, and creating Python files. It also demonstrates Python syntax, comments, and how to run a Python script.

Uploaded by

Marko Refianto
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Lecture Module 1 - Introduction

This document provides an overview of Module 1 of a basic Python programming lecture. It discusses the learning outcomes which include understanding Python's history, installing Python software, and writing Python code. It then covers topics like an introduction to Python, installation instructions, writing a first Python program, and creating Python files. It also demonstrates Python syntax, comments, and how to run a Python script.

Uploaded by

Marko Refianto
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 26

MEN3221221

Basic Programming in Python

Lecture Module 1: Introduction

Prof. Dr. Ir. Supriyono


Prof. Dr. Ir. Waluyo Adi Siswanto
Learning Outcomes

➢ Comprehend the history of Python


➢ Install Python application software
➢ Run Python sript from the
Python's IDLE Integreated Development and Learning
Environment
➢ Writing python codes in .py file

Lecture Module 1 Introduction


Topics

➢ About Python
➢ Installation
➢ Writing the first python program
➢ Writing python .py code

Lecture Module 1 Introduction


About Python

Python is a multipurpose interpretive programming language.

Unlike other languages that are difficult to read and understand, Python
emphasizes more on the readability of code to make it easier to understand
the syntax.

Python very easy to learn both for beginners and for those who already
know other programming languages

This language first appeared in 1991,
1991 designed by a man named Guido van
Rossum (Dutch Programmer). Until now, Python is still being developed by
the Python Software Foundation (www.python.org).

Python language supports almost all operating systems, even for the Linux
operating system, almost all distros already include Python in it.

Just by writing the print code as above, you can print whatever you want in
parentheses. Even at the end of the code, you don't have to end it with a
semicolon ();
print("Python sangat simpel")

Lecture Module 1 Introduction


Installation
1.Open a browser, visit
http://www.python.org/downloads/source/
2.Download the latest version of Python as a zip file for
Unix/Linux
3.Extract the zip file you just downloaded
4.Edit the Modules/Setup file if you want to customize Python
5.Run the script./configure
6.make
7.make install

1.Open a browser, go to http://www.python.org/downloads/windows/


2.Run the python installer file that you just downloaded
3.Follow the installation steps to completion

1.Open a browser, visit


http://www.python.org/download/mac/
2.Download the latest version of Python for Macintosh
3.Open the file you just downloaded
4.Follow the installation steps to completion

Lecture Module 1 Introduction


Go to www.python.og

Lecture Module 1 Introduction


Select the latest version

Lecture Module 1 Introduction


Downloading

Lecture Module 1 Introduction


Run this installation file,
Then follow the instruction

Lecture Module 1 Introduction


Running the first program

b. Select this Python IDE

a. Search IDLE

Lecture Module 1 Introduction


Basic Syntax

Below is an example of a Python function used for
printing. In Python to print just use the function, where
something to be printed must be placed between the
opening bracket and closing parenthesis,
print()

If you want to print the String data type directly, you must
first enclose it in quotation marks.
print("Hello World")

When you run the script above, you will see the output in
the form of text Hello World

Lecture Module 1 Introduction


Python Case Sensitivity

Python is case sensitive, which means uppercase and
lowercase letters have differences. For example, if you
use the function, print with lowercase letters will
succeed.
print()

Another case if you use capital letters or , an error
message will appear.
Print()PRINT()

This rule applies to variable names or other functions.

Lecture Module 1 Introduction


This is the Python programming editor IDLE

Lecture Module 1 Introduction


Write your first python code:

print("Welcome to Python")

then Enter

Lecture Module 1 Introduction


This is the the result of your python code !
Congratulations ….

Lecture Module 1 Introduction


Writing py code

Go to File > New File

Lecture Module 1 Introduction


Start to write the codes

Lecture Module 1 Introduction


Save as > type the name of the file

Lecture Module 1 Introduction


To run the program: Run > Run Module

Lecture Module 1 Introduction


Congratulations, you have successfully run the codes
and you can see the results appear here

Lecture Module 1 Introduction


Commentary


A comment is code inside a Python script that is not executed
or not executed by the machine. Comments are only used to
mark or annotate scripts.

Comments are commonly used to let others understand what
the script is doing or to remind the programmer himself if one
day re-edits the script.

To use comments you simply write a hash sign
#
followed by your comment

or by using a string literal that opens and closes with three “
"""

Lecture Module 1 Introduction


Comment

Lecture Module 1 Introduction


Comment

Lecture Module 1 Introduction


Comment

Lecture Module 1 Introduction


Comment

Lecture Module 1 Introduction


Lecture Module 1 Introduction

You might also like