9.7 Python Programming Basics
This lesson introduces the foundational structure of an imperative programming language using Python. It covers comments, constants, variables, primitive data types, operator categories, operator precedence, and basic input/output operations. Students learn to translate mathematical logic into functional program code while identifying and handling compilation and syntax errors.
ප්රධාන සංකල්ප
- Program Structure
- The standard framework of a computer program consisting of an identifier (header), declarations of variables/constants, the main body where processing occurs, and output commands.
- Comments
- Non-executable descriptive text included within a program to document, explain, and improve the readability of code for future maintenance.
- Variables
- Identifiers used to represent values that can change during the execution of a program (e.g., independent variables like x or dependent variables like y).
- Constants
- Identifiers representing data items whose values remain fixed and unchanged throughout the program's execution.
- Primitive Data Types
- The basic built-in data categories supported by a programming language, such as Integer, Floating-point, String, and Boolean.
- Operators
- Symbols or keywords used to perform specific mathematical, logical, relational, or bitwise operations on data.
- Operator Precedence
- A strict set of rules defining the evaluation order of mathematical and logical operations within a complex expression to ensure consistent, correct results.
- Input and Output Commands
- Syntax structures used to capture data from input devices (e.g., keyboard) and display processed results to standard output devices (e.g., monitor), often requiring type casting.
MCQ කට්ටල
MCQ 12විභාගයේදී
- Evaluating Python expressions based on operator precedence rules.
- Writing simple Python code snippets for mathematical conversions (e.g., Fahrenheit to Centigrade).
- Identifying primitive data types of given variables and outputs.
- Tracing output or identifying syntax/runtime errors in small code blocks.
- Differentiating between constants, dependent variables, and independent variables in Python.
