Unit 3 – Programming Fundamentals (XI Computer Science – FBISE)
Автор: Prep Quest
Загружено: 2026-01-28
Просмотров: 18
Описание:
Programming Language
A programming language is a formal language used to write instructions that a computer can understand and execute.
Examples:
Python
Java
C++
JavaScript
Programming languages act as a bridge between humans and computers.
3.1 Computer Program
A computer program is a complete set of instructions stored in memory that directs a computer to perform operations on data.
Types of Programs:
System programs (Operating systems)
Application programs (Word processors, browsers)
Utility programs (Antivirus, backup tools)
Compiler
A compiler is a translator program that converts a high-level language program into machine language at once. I
Features of Compiler:
Translates whole program at once
Generates object code
Faster execution after compilation
Errors are reported after full translation
Example: C and C++ use compilers.
Interpreter
An interpreter translates and executes a program line by line.
Features of Interpreter:
Line-by-line translation
Slower execution
Easier debugging
Used in interactive environments
Example: Python uses an interpreter.
Assembler
An assembler converts assembly language (low-level language) into machine code.
Characteristics:
One-to-one translation
Machine dependent
Faster execution
Hardware specific
High-Level Languages
High-level languages are user-friendly and closer to human language. They hide hardware details and are easy to learn, write, and maintain.
Examples:
Python
Java
C#
Pascal
Advantages:
Easy to understand
Portable
Less time-consuming
Rich libraries
Low-Level Languages
Low-level languages are closer to machine language and hardware.
Types:
Machine language (0s and 1s)
Assembly language
Advantages:
Fast execution
Efficient memory usage
Direct hardware control
Disadvantages:
Difficult to learn
Machine dependent
Error-prone
Interactive Programs
Interactive programs interact with users during execution. They take input from the user and produce output immediately.
Examples:
Calculator
ATM system
Online forms
Characteristics:
User-driven
Real-time processing
Immediate feedback
Batch Programs
Batch programs process a large volume of data without user interaction. Input is collected first, then processed as a batch.
Examples:
Payroll systems
Examination result processing
Bank statement generation
3.2 Python: An Overview
Python is a high-level, interpreted, general-purpose programming language developed by Guido van Rossum in 1991. It emphasizes simplicity and readability.
Features of Python:
Easy syntax
Interpreted language
Object-oriented
Platform independent
Large standard library
Free and open-source
Python is widely used in:
Education
Web development
Data science
Artificial intelligence
Automation
3.3 Python IDE and Its Components
An IDE (Integrated Development Environment) is software that provides tools to write, edit, run, and debug programs.
Common Python IDEs:
IDLE
PyCharm
VS Code
Jupyter Notebook
Components of Python IDE:
Editor – Used to write Python code
Interpreter – Executes Python programs
Debugger – Helps find and fix errors
Console/Output Window – Displays output
File Manager – Manages program files
3.4 Turtle Library: An Introduction
The turtle library in Python is a graphical module used to draw shapes and patterns. It is especially useful for beginners to learn programming concepts visually.
Key Concepts:
Turtle (cursor)
Screen
Movement commands
Common Turtle Commands:
forward()
backward()
left()
right()
penup()
pendown()
Turtle graphics help in understanding:
Loops
Functions
Coordinates
Logic building
3.5 Libraries in Python
A library is a collection of pre-written code that can be reused to perform common tasks.
Examples of Python Libraries:
math
random
datetime
turtle
Benefits:
Saves time
Reduces errors
Improves productivity
Code reusability
Datetime Library & strftime()
The datetime library is used to work with dates and times in Python.
strftime() Function:
It formats date and time into readable strings.
Common Arguments:
%Y → Year
%m → Month
%d → Day
%H → Hour
%M → Minute
%S → Second
Example Demonstration:
from datetime import datetime
now = datetime.now()
print(now.strftime("%Y-%m-%d %H:%M:%S"))
This displays the current date and time in a formatted form.
Conclusion
Unit 3 provides the foundation of programming by introducing programs, languages, translators, Python basics, IDEs, libraries, and graphical tools like turtle. Mastery of these concepts prepares students for advanced programming and real-world problem-solving.
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: