• Tidak ada hasil yang ditemukan

PDF CSIT 110 FUNDAMENTAL PROGRAMMING WITH PYTHON - StudentVIP

N/A
N/A
Protected

Academic year: 2025

Membagikan "PDF CSIT 110 FUNDAMENTAL PROGRAMMING WITH PYTHON - StudentVIP"

Copied!
7
0
0

Teks penuh

(1)

CSIT 110 FUNDAMENTAL PROGRAMMING

WITH PYTHON

CSIT 110 LECTURE NOTES

“Success consists of going from failure to failure

without loss of enthusiasm.”

--Winston Churchill

(2)

2

Table of Contents

Click the heading link below to go to the specific lecture notes.

CSIT 110 Lecture 1... 3

CSIT 110 Lecture 2... 14

CSIT 110 Lecture 3... 19

CSIT 110 Lecture 4... 31

CSIT 110 Lecture 5... 38

CSIT 110 Lecture 6... 43

CSIT 110 Lecture 7... 52

CSIT 110 Lecture 8... 68

CSIT 110 Lecture 9... 71

CSIT 110 Lecture 10 ... 82

CSIT 110 Lecture 11 ... 94

CSIT 110 Lecture 12 ... 104

(3)

CSIT 110 Lecture 1 Fundamental Programming With Python

3

CSIT 110 Lecture 1

Input and Output 1

Comments

• We can put comments anywhere in the program:

✓ To make the program clearer for people to read and maintain

✓ To help people understand our program better, especially, if our program has a special logic that needs explanation

✓ Comments are not code, so they will not be executed

The print function

• print () will print a new empty line

(4)

4

Variables and Data types

• a, b, c are called variables

✓ variables are reserved memory locations to store values

• Variables store values in certain data types:

***To check data type: print (type (variable_name)) 1. String

str

✓ represents a sequence of characters

✓ With “” in a function

✓ The content inside the “” will be displayed in the output

✓ Can use either “” or ‘’

✓ Exp:

(5)

CSIT 110 Lecture 1 Fundamental Programming With Python

5

✓ Exp:

To check data type:

2. Integer

int

✓ a whole number

✓ With no “” in a function

✓ The value of the number will be displayed in the output

✓ Exp:

✓ Exp:

To check data type:

(6)

6

3. Float

float

✓ a decimal number

✓ Exp:

To check data type:

Some important math constants

4. Boolean

bool

✓ Either True or False

✓ Exp:

✓ Exp:

To check data type:

(7)

CSIT 110 Lecture 1 Fundamental Programming With Python

7

5. Date data type

✓ Including year, month, day, (not the time)

✓ Exp:

6. Date-time data type

✓ Including year, month, day, hour, minute, second, …

✓ Exp:

Referensi

Dokumen terkait