Computer Science 1MD3 Introduction to Programming

12
S Computer Science 1MD3 Introduction to Programming Michael Liut ([email protected] ) Winter 2014 www.michaelliut.ca/cs1md3

description

Winter 2014. Computer Science 1MD3 Introduction to Programming. Michael Liut ( [email protected] ). Table of Contents. Python H igh or Low Level Language? Function vs. Method Nested For Loop Assignment 1_3 & 1_4 Practice MidTerm Questions. High vs. Low Level Languages. - PowerPoint PPT Presentation

Transcript of Computer Science 1MD3 Introduction to Programming

Page 1: Computer Science 1MD3 Introduction to Programming

www.michaelliut.ca/cs1md3

S

Computer Science 1MD3

Introduction to Programming

Michael Liut ([email protected])

Winter 2014

Page 2: Computer Science 1MD3 Introduction to Programming

www.michaelliut.ca/cs1md3

Table of Contents

Python High or Low Level Language?

Function vs. Method

Nested For Loop

Assignment 1_3 & 1_4

Practice MidTerm

Questions

Page 3: Computer Science 1MD3 Introduction to Programming

www.michaelliut.ca/cs1md3

High vs. Low Level Languages

PYTHON IS A HIGH LEVEL LANGUAGE

High Level Language Allows programmers to write algorithms, loops, and

functions/methods without detailed knowledge of the hardware

Examples: C, C++, Java, and Python

Low Level Language Requires detailed knowledge of machine level

coding: involvement with registers, interrupts, etc.. Example: MARIE Simulator

Page 4: Computer Science 1MD3 Introduction to Programming

www.michaelliut.ca/cs1md3

Functions vs. Methods

A function is a piece of code that can pass data through it (in the form of a parameter) and can return data (optional).

A method is a piece of code that is associated with an object defined in the class. Two key elements: A method is implicitly passed A method is able to operate on data contained

within the class

Page 5: Computer Science 1MD3 Introduction to Programming

www.michaelliut.ca/cs1md3

Nested For Loop

A for loop within a for loop An inner loop enclosed inside an outer loop

Textbook pages 143-144

Example Program

Page 6: Computer Science 1MD3 Introduction to Programming

www.michaelliut.ca/cs1md3

Page 7: Computer Science 1MD3 Introduction to Programming

www.michaelliut.ca/cs1md3

Page 8: Computer Science 1MD3 Introduction to Programming

www.michaelliut.ca/cs1md3

S

Assignment 1_3 & 1_4

Solutions

Page 9: Computer Science 1MD3 Introduction to Programming

Assignment 1_3www.michaelliut.ca/cs1md3

Page 10: Computer Science 1MD3 Introduction to Programming

Assignment 1_4www.michaelliut.ca/cs1md3

Page 11: Computer Science 1MD3 Introduction to Programming

www.michaelliut.ca/cs1md3

S

Practice MidTerm REAL TEST TOMORROW: Thu. Feb 13, 2014

at 16:30-17:20 in T28

Page 12: Computer Science 1MD3 Introduction to Programming

www.michaelliut.ca/cs1md3

S

Questions?