title: Python Study Notes-03
date: 2019-10-21 15:58:05.0
updated: 2022-01-24 17:27:44.221
url: /archives/python-notes-03
categories:
- Study Notes
tags: - Python
Python Program File Structure
Python Program Files#
Python program files that contain a series of pre-written statements are called "modules."
Modules that can be directly executed are usually referred to as scripts (i.e., the top-level files of a program).
Python programs can be decomposed into modules, statements, expressions, and objects#
Programs are composed of modules.
Modules contain statements.
Statements contain expressions.
Expressions create and manipulate objects.
- Expressions are "something," while statements are "do something" (i.e., instructions);
- For example, "3+4" is something, while the statement "print 3+4" is doing something;
- Characteristics of statements: they change things. For example, an assignment statement changes a variable, a print statement changes screen output, etc.
Procedural vs Object-Oriented#
Procedural:
- Centers around instructions, with instructions processing data. It focuses on how to organize code to solve problems.
Object-Oriented:
- Centers around data, with all processing code revolving around data. It focuses on designing data structures to organize data and providing operations to manipulate such data.