Outcome #1: Define computer programming concepts.
A program is a sequence of instructions specifying how to perform a computation.
Computations can be categorized into:
Mathematical: Solving equations.
Symbolic: Searching/replacing text in a document.
Graphical: Processing images or videos, and more.
Problem solving is crucial for computer scientists:
It involves formulating problems, thinking creatively about solutions, and expressing these solutions clearly.
Learning to write computer programs provides an excellent opportunity to practice these skills.
Example Problem: To find speed during a journey:
Know distance.
Know time.
Divide distance by time to find speed.
Display the speed result.
Definition: A language is a tool to express and record thoughts.
Machine Language: The computer's own language.
Natural Language: Human languages; a common language for humans and computers is necessary.
A programming language is a formal language used to create computer programs.
Examples of programming languages:
Python
C++
JavaScript
Scala
Java
PHP
Ruby
C#
A programmer is someone skilled in programming.
Responsibilities include:
Writing source code for applications.
Testing, maintaining, and debugging software applications.
Input: Acquiring data from external sources (keyboard, files, sensors).
Output: Displaying results or storing them (e.g., on a screen or in a file).
Execution Types:
Sequential execution: Running statements one after another.
Conditional execution: Executing or skipping statements based on certain conditions.
Repeated execution: Running a set of statements multiple times, with variations.
Reuse: Creating named instructions for recurring use throughout the program.
General Characteristics:
Easy to learn.
Widely used in various organizations (e.g., Google, NASA, Yahoo).
Created by Guido van Rossum in 1991.
Named after “Monty Python’s Flying Circus.”
Notable companies include:
Nokia
Amazon
Dropbox
Yahoo!
IBM
Quora
Disney
Netflix
Simplicity and Power:
Efficient high-level data structures.
Object-oriented programming capabilities.
Characteristics:
Interpreted language with dynamic semantics.
High-level language: No need to manage memory.
Portable across platforms without changes.
Simple and Minimalistic Language:
Easy to learn and has an intuitive syntax.
Free and Open Source:
Can be freely distributed and modified.
Interpreted Language:
Runs programs directly from source code by converting into bytecodes and then running on the native mode.
Object-Oriented:
Supports both procedural and object-oriented programming, enabling code reuse and reducing complexity.
Procedure-Oriented Language:
Centers around procedures or functions, executing commands in a specific order, facilitating code reuse.
Object-Oriented Language:
Focuses on objects combining data and functionalities, reflecting real-world interactions.
Extensible:
Critical pieces of code can be written in fast languages (e.g., C/C++) and called from Python.
Embedded:
Python can be integrated within C/C++ programs for scripting capabilities.
Python has a vast Standard Library assisting with:
Regular expressions, multi-threading, databases, web browsers, HTML, GUI development, etc.
Machine Language:
Comprised of zeros and ones (binary), specific to hardware and not portable.
High-Level Language:
Python is user-friendly for reading and writing, contrasting with machine language.
Types of Translators:
Interpreters: Read source code and execute on the fly.
Compilers: Convert entire source code to machine language at once.
Interpreter:
Processes Python code instantly, allowing immediate response in an interactive setting.
Compiler:
Translates source code into machine language, creating files for later execution.
Written in three lines:
Line 1: Comment indicating program start (#).
Line 2: print(“Hello world!”)
function to output text.
Line 3: Comment indicating program end (#).
Features:
Enables creation and execution of interactive programs in a single document.
Accessible through a web browser with features for direct sharing and visualization.
Applications:
Includes Jupyter Notebook, JupyterLab, Spyder (IDE) for Python development.
Creating a New Notebook:
Accessible via the 'New' button in the Jupyter interface for Python 3.
Notebook Cells:
Comprised of various cell types:
Code Cell: Contains executable code.
Markdown Cell: Contains formatted text.
Raw Cell: Displays content without processing.
To execute cells:
Select and press shift + enter
or ctrl + enter
.
Options to run all cells or specific ones.
Features for adding, deleting, and reordering cells.
Supports saving and downloading in various formats (.ipynb, .py, .pdf, .html).
Learning resources:
Severance C. R. (2016). Python for Everybody.
Swaroop C.H. (2013). A Byte of Python.
Downey A.B. (2016). Think Python.
Romano F. (2018). Learn Python Programming.