Introduction to Programming Professor Sprenkle September 10, 2007.

Slides:



Advertisements
Similar presentations
CS107: Introduction to Computer Science Lecture 2 Jan 29th.
Advertisements

Introduction to Programming
* Programming is the activity of creating a set of detailed instructions (program) that when carried out on a consistent set of inputs will result in.
Overview of Programming and Problem Solving ROBERT REAVES.
Chapter 1 - An Introduction to Computers and Problem Solving
Computer Software & Software Development H&K Chapter 1 Instructor – Gokcen Cilingir Cpt S 121 (June 20, 2011) Washington State University.
Algorithm Design CS105. Problem Solving Algorithm: set of unambiguous instructions to solve a problem – Breaking down a problem into a set of sub- problems.
CS 110 Intro to Computer Science I Sami Rollins Fall 2006.
Guide To UNIX Using Linux Third Edition
Introduction to Unix (CA263) Introduction to Shell Script Programming By Tariq Ibn Aziz.
CS 101 Problem Solving and Structured Programming in C Sami Rollins Spring 2003.
CS 104 Introduction to Computer Science and Graphics Problems Software and Programming Language (2) Programming Languages 09/26/2008 Yang Song (Prepared.
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 1 Introduction.
An Introduction to Operating Systems. Definition  An Operating System, or OS, is low-level software that enables a user and higher-level application.
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
CCSA 221 Programming in C CHAPTER 2 SOME FUNDAMENTALS 1 ALHANOUF ALAMR.
Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 1 Introduction to Computers and Programming.
CSC 110 A 1 CSC 110 Introduction to Python [Reading: chapter 1]
Python Mini-Course University of Oklahoma Department of Psychology Day 1 – Lesson 2 Fundamentals of Programming Languages 4/5/09 Python Mini-Course: Day.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
Startup – Chapter 1.
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
CIS Computer Programming Logic
1 TOPIC 1 INTRODUCTION TO COMPUTER SCIENCE AND PROGRAMMING Topic 1 Introduction to Computer Science and Programming Notes adapted from Introduction to.
Introduction to Programming. What is a Program  Set of Instructions that tells the computer what to Do.  Driving force behind the computer  Without.
Programming Intro Problem Solving: 1)Understand the problem This often involves breaking the problem into manageable pieces 2) Develop a plan May develop.
CSC141 Introduction to Computer Programming
Standard Grade Computing System Software & Operating Systems.
CSC-115 Introduction to Computer Programming
Chapter 1 What is Programming? Lecture Slides to Accompany An Introduction to Computer Science Using Java (2nd Edition) by S.N. Kamin, D. Mickunas, E.
 Why?  Because it can be programmed to do more than one specific task. ◦ Accountants ~ tax forms etc. ◦ Machinists ~ control drilling, lathes etc. ◦
Chapter 1 Introduction. Goal to learn about computers and programming to compile and run your first Java program to recognize compile-time and run-time.
COP 3530 PROGRAM, FILE & DATA STRUCTURES Syllabus Syllabus Lab Information Lab Information Overrides Overrides Questions? Questions?
TMF1013 : Introduction To Computing Lecture 1 : Fundamental of Computer ComputerFoudamentals.
Computer Programming A program is a set of instructions a computer follows in order to perform a task. solve a problem Collectively, these instructions.
Sep 12, 2007Sprenkle - CS1111 Objectives Review  Linux  Why programming languages? Compiled vs. Interpreted Languages Programming in Python  Data types.
August 29, 2005ICP: Chapter 1: Introduction to Python Programming 1 Introduction to Computer Programming Chapter 1: Introduction to Python Programming.
Python From the book “Think Python”
Guide to Programming with Python Chapter One Getting Started: The Game Over Program.
Fundamental Programming: Fundamental Programming K.Chinnasarn, Ph.D.
Problem Solving using the Science of Computing MSE 2400 EaLiCaRA Spring 2015 Dr. Tom Way.
Intro to Python Adriane Huber Debbie Bartlett Python Lab #1Python Lab #1 1.
B.Ramamurthy11/9/20151 Computers and Programming Bina Ramamurthy 127 Bell Hall
Unit 1 Basic Python programs, functions Special thanks to Roy McElmurry, John Kurkowski, Scott Shawcroft, Ryan Tucker, Paul Beck for their work. Except.
CS 127 Introduction to Computer Science. What is a computer?  “A machine that stores and manipulates information under the control of a changeable program”
CS 100 Introduction to Computing Seminar September 21, 2015.
Chapter 1 Computers, Compilers, & Unix. Overview u Computer hardware u Unix u Computer Languages u Compilers.
Introduction to Programming in VB Chapter 1. 2 Software Development Life Cycle Gather Requirements Design Program Code & Test Program Implement u Software.
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.
1 Overview of Programming Principles of Computers.
Lecture #1: Introduction to Algorithms and Problem Solving Dr. Hmood Al-Dossari King Saud University Department of Computer Science 6 February 2012.
INTRODUCTION TO COMPUTER PROGRAMMING(IT-303) Basics.
Introduction to Problem Solving Programming is a problem solving activity. When you write a program, you are actually writing an instruction for the computer.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
Programming Logic and Design Seventh Edition Chapter 1 An Overview of Computers and Programming.
A Python Tour: Just a Brief Introduction
Key Ideas from day 1 slides
Lesson 1 An Introduction
Algorithm and Ambiguity
Algorithm and Ambiguity
Computer Software CS 107 Lecture 2 September 1, :53 PM.
Assembler, Compiler, Interpreter
Introduction to Computer Programming
Unit 1: Introduction Lesson 1: PArts of a java program
Chapter 1 Introduction(1.1)
Problem Solving Skill Area 305.1
Assembler, Compiler, Interpreter
Introduction to Programming with Python
12th Computer Science – Unit 5
PYTHON - VARIABLES AND OPERATORS
Presentation transcript:

Introduction to Programming Professor Sprenkle September 10, 2007

Sep 10, 2007Sprenkle - CS1112 Objectives Introduction to problem solving Introduction to problem solving Introduction to Python Introduction to Python Introduction to Linux Introduction to Linux

Sep 10, 2007Sprenkle - CS1113 Computational Problem Solving 101 Computational Problem Computational Problem  A problem that can be solved by logic To solve the problem: To solve the problem:  Create a model of the problem  Design an algorithm for solving the problem using the model  Write a program that implements the algorithm

Sep 10, 2007Sprenkle - CS1114 Computational Problem Solving 101 Algorithm: a well-defined recipe for solving a problem Algorithm: a well-defined recipe for solving a problem  Has a finite number of steps  Completes in a finite amount of time Program Program  An algorithm written in a programming language  Also called code Application Application  Large programs, solving many problems

Sep 10, 2007Sprenkle - CS1115 More on Algorithms Algorithms often have a defined type of input and output. Algorithms often have a defined type of input and output. Correct algorithms give the intended output for a set of input. Correct algorithms give the intended output for a set of input. Example: Multiply by 10 Example: Multiply by 10  I/O for a correct algorithm: 5,50 5,50.32, , 3.2 x, 10x x, 10x More examples: Long division, recipes More examples: Long division, recipes input algorithm output IO

Sep 10, 2007Sprenkle - CS1116 Making a Peanut Butter & Jelly Sandwich How do you make a peanut butter and jelly sandwich? How do you make a peanut butter and jelly sandwich? Write down the steps so that someone else can follow your instructions Write down the steps so that someone else can follow your instructions  Make no assumptions about the person’s knowledge of PB&J sandwiches  The person has the following materials: Loaf of bread, Jar of PB, Jelly, 2 Knives, paper plates, napkins Loaf of bread, Jar of PB, Jelly, 2 Knives, paper plates, napkins

Sep 10, 2007Sprenkle - CS1117 Discussion of PB&J The computer: a blessing and a curse The computer: a blessing and a curse  Recognize and meet the challenge! Be unambiguous, descriptive Be unambiguous, descriptive  Must be clear for the computer to understand  “Do what I meant! Not what I said!” Creating/Implementing an algorithm Creating/Implementing an algorithm  Break down pieces  Try it out  Revise

Sep 10, 2007Sprenkle - CS1118 Discussion of PB&J Be prepared for special cases Be prepared for special cases Aren’t necessarily spares in real life Aren’t necessarily spares in real life  Need to write correct algorithms! Reusing similar techniques Reusing similar techniques  Do the same thing with a little twist Looping Looping  For repeating the same action

Sep 10, 2007Sprenkle - CS1119 Parts of an Algorithm Primitive operations Primitive operations  What data you have, what you can do to the data Naming Naming  Identify things we’re using Sequence of operations Sequence of operations Conditionals Conditionals  Handle special cases Repetition/Loops Repetition/Loops Subroutines Subroutines  Call, reuse similar techniques An overview for the semester!

Sep 10, 2007Sprenkle - CS11110 Other Lessons To Remember A cowboy’s wisdom: Good judgment comes from experience A cowboy’s wisdom: Good judgment comes from experience  How can you get experience?  Bad judgment works every time Program errors can have bad effects Program errors can have bad effects  Prevent the bad effects--especially before you turn in your assignment!

Sep 10, 2007Sprenkle - CS11111 Computational Problem Solving 101 Computational Problem Computational Problem  A problem that can be solved by logic To solve the problem: To solve the problem:  Create a model of the problem  Design an algorithm for solving the problem using the model  Write a program that implements the algorithm

Sep 10, 2007Sprenkle - CS11112 Programming Languages Programming language: Programming language:  Specific rules for what is and isn’t allowed  Must be exact  Computer carries out commands as they are given Syntax: the symbols given Syntax: the symbols given Semantics: what it means Semantics: what it means Example: III * IV = 3 x 4 = 12 Example: III * IV = 3 x 4 = 12 Programming languages are unambiguous Programming languages are unambiguous

Sep 10, 2007Sprenkle - CS11113 Python A common interpreted programming language A common interpreted programming language First released by Guido van Rossum in 1991 First released by Guido van Rossum in 1991 Named after Monty Python’s Flying Circus Named after Monty Python’s Flying Circus Minimalist syntax, emphasizes readability Minimalist syntax, emphasizes readability Flexible, fast, useful language Flexible, fast, useful language Used by scientists, engineers, systems programmers Used by scientists, engineers, systems programmers

Sep 10, 2007Sprenkle - CS111 Python Interpreter Simulates a computer Simulates a computer Gives user immediate feedback Gives user immediate feedback  E.g., if program contains error Behind the scenes: interpreter (a program itself) turns each expression into bytecode and then executes the expression Behind the scenes: interpreter (a program itself) turns each expression into bytecode and then executes the expression Interpreter (python) Python expression Output Executable bytecode

Sep 10, 2007Sprenkle - CS11115 The Programming Process 1. Programmer types a program/script into a text editor (jEdit or IDLE). 2. An interpreter (a program itself) turns each expression into bytecode and then executes each expression Interpreter (python) Program text file program.py Output Text Editor (jEdit or IDLE) Executable bytecode

Sep 10, 2007Sprenkle - CS11116 UNIX/Linux operating system Operating system Operating system  Manages the computer’s resources, e.g., CPU, memory, disk space  Examples: UNIX, Windows XP, Windows 2000, Mac OSX, Linux, etc. UNIX/Linux UNIX/Linux  Command-line interface (not a GUI)  Type commands into terminal window  Example commands: cp file1.c file1copy.c (copy a file) cp file1.c file1copy.c (copy a file) mkdir cisc105 (make a directory) mkdir cisc105 (make a directory)

Sep 10, 2007Sprenkle - CS11117 The Programming Process In a Linux terminal:  jedit &  or idle &  python  E.g., python hello.py Interpreter (python) Program text file program.py Output Text Editor (jEdit or IDLE) Executable bytecode