Chapter 1: Programming Basics, Python History and Program Components

Slides:



Advertisements
Similar presentations
COMPUTER PROGRAMMING Task 1 LEVEL 6 PROGRAMMING: Be able to use a text based language like Python and JavaScript & correctly use procedures and functions.
Advertisements

 2005 Pearson Education, Inc. All rights reserved Introduction.
Programming Introduction November 9 Unit 7. What is Programming? Besides being a huge industry? Programming is the process used to write computer programs.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
PYTHON: LESSON 1 Catherine and Annie. WHAT IS PYTHON ANYWAY?  Python is a programming language.  But what’s a programming language?  It’s a language.
CHAPTER 4: INTRODUCTION TO COMPUTER ORGANIZATION AND PROGRAMMING DESIGN Lec. Ghader Kurdi.
1 Chapter One A First Program Using C#. 2 Objectives Learn about programming tasks Learn object-oriented programming concepts Learn about the C# programming.
A First Program Using C#
Microsoft Visual Basic 2005: Reloaded Second Edition
General Computer Science for Engineers CISC 106 Lecture 02 Dr. John Cavazos Computer and Information Sciences 09/03/2010.
Chapter 1: A First Program Using C#. Programming Computer program – A set of instructions that tells a computer what to do – Also called software Software.
Introduction to Programming Peggy Batchelor.
August 29, 2005ICP: Chapter 1: Introduction to Python Programming 1 Introduction to Computer Programming Chapter 1: Introduction to Python Programming.
Java Programming, Second Edition Chapter One Creating Your First Java Program.
Week 1 - Friday.  What did we talk about last time?  Our first Java program.
Python From the book “Think Python”
Guide to Programming with Python Chapter One Getting Started: The Game Over Program.
Object Oriented Programming Lecture 3. Introduction  In discussing Java, some items need to be clarified  The Java programming language  The Java virtual.
I Power Higher Computing Software Development Development Languages and Environments.
Introduction to Python Dr. José M. Reyes Álamo. 2 Three Rules of Programming Rule 1: Think before you program Rule 2: A program is a human-readable set.
CSC 1010 Programming for All Lecture 2 Introduction to Python Some material based on material from Marty Stepp, Instructor, University of Washington.
8 January 2016Birkbeck College, U. London1 Introduction to Programming Lecturer: Steve Maybank Department of Computer Science and Information Systems
A Python Tour: Just a Brief Introduction "The only way to learn a new programming language is by writing programs in it." -- B. Kernighan and D. Ritchie.
Introducing Python 3 Introduction to Python. Introduction to Python L1 Introducing Python 3 Learning Objectives Know what Python is and some of the applications.
PROBLEM SOLVING WARM-UP Fill in the spaces using any operation to solve the following (!, (), -/+,÷,×): = 6.
Introduction to Programming
CS210 Intermediate Computing with Data Structures (Java)
Fundamentals of Programming I Overview of Programming
Installing Java on a Home machine
Introducing Python Introduction to Python.
Development Environment
CST 1101 Problem Solving Using Computers
Whatcha doin'? Aims: To start using Python. To understand loops.
A Python Tour: Just a Brief Introduction
Release Numbers MATLAB is updated regularly
Introduction to Python
GCSE COMPUTER SCIENCE Practical Programming using Python
GCSE COMPUTER SCIENCE Practical Programming using Python
Topics Introduction Hardware and Software How Computers Store Data
Introduction to Python
Introduction to Python
Topics Introduction to Repetition Structures
Introduction to Python
Guide To UNIX Using Linux Third Edition
Chapter 2 First Java Programs
Introduction to Programming
Introduction to Programming
Unit# 8: Introduction to Computer Programming
Do you know this browser?...
Installing Java on a Home machine
Chapter 1 Coding Introduction.
Introduction to Python
Week 1 Computer Programming Year 9 – Unit 9.04
An Introduction to Structured Program Design in COBOL
Topics Introduction Hardware and Software How Computers Store Data
Task 1 Computer Programming LEVEL 6 PROGRAMMING:
Topics Designing a Program Input, Processing, and Output
Section 1 Introduction To Programming
Introduction to Programming
CSCI N317 Computation for Scientific Applications Unit 1 – 1 MATLAB
CS 1111 Introduction to Programming Spring 2019
Introduction to Python
12th Computer Science – Unit 5
Input and Output Python3 Beginner #3.
Introduction to Python
General Computer Science for Engineers CISC 106 Lecture 03
Computer Programming-1 CSC 111
L L Line CSE 420 Computer Games Lecture #3 Introduction to Python.
Programming for Business Computing Introduction
PYTHON - VARIABLES AND OPERATORS
Presentation transcript:

Chapter 1: Programming Basics, Python History and Program Components CS10061 – Introduction to Computer Programming Chapter 1: Getting Started

Why Write Computer Programs? To assist with a complex situation that requires a human touch Managing livestock Patient simulators Forensics Weather predictions Chapter 1: Getting Started

Why Write Computer Programs? To aid with creative thought and higher-level organization Virtual dancers Online academic classes Games Chapter 1: Getting Started

Why Write Computer Programs? To perform routine or repetitive tasks that follow a clear series of steps or work with electronic information Package deliveries Robotics or smart devices Banking transactions Chapter 1: Getting Started

Programming Basics A computer program contains instructions written by humans and understandable by computers (statements vs. instructions). A programming language is used to write a computer program. Chapter 1: Getting Started

Program Basics – Cont’d: Are all programming languages the same? No, there are many differences Machine-like vs. English-like Compiler (source code) vs. interpreted (dynamic) Commercial vs. open-source Platform dependent vs. platform independent Chapter 1: Getting Started

Program Basics – Cont’d: How do you get started with programs? Identify the task to solve or automate Determine the programming language to use Install the programming language Read the documentation and learn the jargon Navigate the working environment (IDLE) Chapter 1: Getting Started

Python’s History Developed by Guido van Rossum Released in 1991 Named after the English comedy troupe Monty Python (many unique references), but the current mascot is a little green snake Chapter 1: Getting Started

Why Use Python? Easy to learn and easy to use Powerful and efficient (no compilation) Open-source and free Platform independent Integrates or embeds easily with other programming languages Object-oriented ability is optional Chapter 1: Getting Started

Python IDLEs Python’s IDLEs are working environments for programmers. Statements are entered: At a command prompt (>>>) In a text editor There are two main IDLEs in Python Interactive (Shell) Mode (command prompt) Script Mode (text editor) Chapter 1: Getting Started

Python Interactive (Shell) Mode Utilizes the command prompt (>>>) Results are displayed to the screen immediately Not usable with programs that are already created and saved Automatically invoked for screen output when a saved program is run Useful for trying out correct syntax Chapter 1: Getting Started

Python Script Mode Environment is like a text editor (Notepad) Enables the writing, saving and editing of programs Invoke by File  New Window from the interactive (shell) mode Save by File  Save As Name the file and add the “.py” extension Run with Edit  Run Script Results are displayed in a shell window Chapter 1: Getting Started

Program Components Statements do something Commands force action In English, they convey complete thoughts In Python, they give complete instructions Commands force action Denoted in orange Case sensitive, specifically lowercase Part of a statement Example: print “Hello, World” Command Chapter 1: Getting Started

Program Components Expressions are something with a value Denoted in green Part of a statement Values may be: Strings or series of characters Example: print “Hello, World” Numbers, a particular number Example: print 17 Evaluations, say 3 + 1 Example: print 3 + 1 String Number Evaluation Chapter 1: Getting Started

Program Components: Syntax Errors Syntax errors result when the interpreter cannot understand a statement Misspellings of commands Incorrect command usage Other typographical mistakes The error displayed generally indicates what is wrong with the statement Familiarize yourself with what syntax errors mean so errors may be fixed quickly Chapter 1: Getting Started

Program Components: Syntax Errors – Cont’d. Misspellings of commands Example: prnt “Hello, World” produces The cursor highlights the last character of the statement SyntaxError: invalid syntax Chapter 1: Getting Started

Program Components: Syntax Errors – Cont’d. Incorrect command usage Example: Hello produces A new command prompt is displayed Traceback (most recent call last): File "<pyshell#0>", line 1, in ? hello NameError: name 'hello' is not defined Chapter 1: Getting Started

Program Components: Syntax Errors – Cont’d. Other typographical mistakes Example: prnt “Hello, World produces The word “World” is highlighted to indicate the “token” SyntaxError: invalid token Chapter 1: Getting Started

Program Components Comments are used for program documentation Denoted in red Assists with understanding the code (original developer or subsequent programmers) Preceded by “#” which is ignored by the interpreter at program execution Good programming practice dictates the use, especially as the program “header” Chapter 1: Getting Started

Program Components Blank lines Prompts Used to separate blocks of related statements Aids in reading the source code Ignored by the interpreter at program execution Prompts Used to ask the user for input Forces the console window to remain open Example: raw_input(“\n\nPress the enter key to exit.”) Chapter 1: Getting Started