CSC 108H: Introduction to Computer Programming Summer 2012 Marek Janicki.

Slides:



Advertisements
Similar presentations
More on Algorithms and Problem Solving
Advertisements

5-1 Flow of Control Recitation-01/25/2008  CS 180  Department of Computer Science  Purdue University.
Program Design and Development
Software design and development Marcus Hunt. Application and limits of procedural programming Procedural programming is a powerful language, typically.
Recitation 1 Programming for Engineers in Python.
Python Control of Flow.
Lilian Blot CORE ELEMENTS COLLECTIONS & REPETITION Lecture 4 Autumn 2014 TPOP 1.
Python quick start guide
CIS Computer Programming Logic
Introduction to Python
Programing Concept Ken Youssefi/Ping HsuIntroduction to Engineering – E10 1 ENGR 10 Introduction to Engineering (Part A)
Introduction. 2COMPSCI Computer Science Fundamentals.
Programming Fundamentals. Today’s lecture Decisions If else …… Switch Conditional Operators Logical Operators.
CS105 Computer Programming PYTHON (based on CS 11 Python track: lecture 1, CALTECH)
CSC 1051 – Data Structures and Algorithms I Dr. Mary-Angela Papalaskari Department of Computing Sciences Villanova University Course website:
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.
General Computer Science for Engineers CISC 106 Lecture 12 James Atlas Computer and Information Sciences 08/03/2009.
Midterm Review Important control structures Functions Loops Conditionals Important things to review Binary Boolean operators (and, or, not) Libraries (import.
September 7, 2004ICP: Chapter 3: Control Structures1 Introduction to Computer Programming Chapter 3: Control Structures Michael Scherger Department of.
Lecture 15: Course Review BJ Furman ME 30 16MAY2011.
CS190/295 Programming in Python for Life Sciences: Lecture 6 Instructor: Xiaohui Xie University of California, Irvine.
A High Flying Overview CS139 – Fall 2006 How far we have come.
CISC105 – General Computer Science Class 4 – 06/14/2006.
4 - Conditional Control Structures CHAPTER 4. Introduction A Program is usually not limited to a linear sequence of instructions. In real life, a programme.
CSC 108H: Introduction to Computer Programming Summer 2012 Marek Janicki.
CSC 108H: Introduction to Computer Programming Summer 2011 Marek Janicki.
CSC 108H: Introduction to Computer Programming Summer 2012 Marek Janicki.
CSC 108H: Introduction to Computer Programming Summer 2012 Marek Janicki.
CSC 108H: Introduction to Computer Programming Summer 2012 Marek Janicki.
CSC 108H: Introduction to Computer Programming Summer 2011 Marek Janicki.
CSC 108H: Introduction to Computer Programming Summer 2012 Marek Janicki.
CSC 108H: Introduction to Computer Programming Summer 2011 Marek Janicki.
CSC 108H: Introduction to Computer Programming Summer 2012 Marek Janicki.
CSC 108H: Introduction to Computer Programming Summer 2012 Marek Janicki.
CSC 108H: Introduction to Computer Programming Summer 2011 Marek Janicki.
CSC 108H: Introduction to Computer Programming
Information and Computer Sciences University of Hawaii, Manoa
Control Flow (Python) Dr. José M. Reyes Álamo.
Python Review 1.
CprE 185: Intro to Problem Solving (using C)
CS170 – Week 1 Lecture 3: Foundation Ismail abumuhfouz.
CSC 108H: Introduction to Computer Programming
Introduction to Python
Computer Programming Fundamentals
CMSC201 Computer Science I for Majors Lecture 21 – Dictionaries
CS-104 Final Exam Review Victor Norman.
CS1371 Introduction to Computing for Engineers
CSC 108H: Introduction to Computer Programming
CSC 108H: Introduction to Computer Programming
CSC 108H: Introduction to Computer Programming
CSC 108H: Introduction to Computer Programming
Chapter 4 – Control Structures Part 1
Programming Fundamentals
Algorithm and Ambiguity
PH2150 Scientific Computing Skills
CS139 – Fall 2010 How far we have come
Arithmetic operations, decisions and looping
Topics Introduction to File Input and Output
CS190/295 Programming in Python for Life Sciences: Lecture 6
Topic 1: Problem Solving
I210 review.
Coding Concepts (Basics)
` Structured Programming & Flowchart
Python Tutorial for C Programmer Boontee Kruatrachue Kritawan Siriboon
Algorithm and Ambiguity
Topics Introduction to Value-returning Functions: Generating Random Numbers Writing Your Own Value-Returning Functions The math Module Storing Functions.
Focus of the Course Object-Oriented Software Development
Introduction to Programming
Python Review
Topics Introduction to File Input and Output
Presentation transcript:

CSC 108H: Introduction to Computer Programming Summer 2012 Marek Janicki

Aug Administration ● Final is Thurs. Aug 16, 7-10 in SF 3201 ● Office hours have moved to BA2230 ● They will be F2-4 this week, M4-6 and W2-4 next week ● Need 40% to pass ● Old Finals posted. ● Assignment 1 autotesting is out.

Aug Quick Correction ● To get access to the specific object that caused an exception one uses: ● try: ● block ● except Exception as e: ● #block can now reference e ● block

Aug Course Review ● Types ● int, float, bool, str ● list, dict. – be wary of aliasing. ● Control flow syntax ● If statements ● loops ● return vs. print

Aug Course Review ● Structure of Programming. ● Functions, modules, classes. ● reusing code, making it extendable. ● Meta-Programming ● Testing ● Code Design ● Documentation ● Complexity ● Algorithm Design

Aug Immutable Type Review ● Ints and Floats. ● represent numbers ● can use +, -, *, /, **. ● can be compared with ==,, etc. – returns a boolean. ● If there is a float in one operation, the result gets cast to a float.

Aug Immutable Type Review ● Bool ● can be True or False. ● has the following operators: and, or, not. ● Used for control flow structures. – So is generated by ==, =, not, etc. ● str ● called strings. ● Used to represent sequences of characters. ● comes with lots of methods.

Aug Mutable Type Review ● Lists ● Is a list of items. ● Can be looped over. ● Can check if elements are inside of the list. ● Each list element can be changed ● Have aliasing problems. ● Often used to store related data. ● Size can change. ● Has lots of methods.

Aug Mutable Type Review ● Dictionaries ● Should be viewed as a set of key:value pairs. – The keys must be immutable and unique – The values can be anything. ● Can easily (and quickly) check if a dictionary contains a key. ● Checking if it contains a value is much slower – linear time, not constant. ● Has many useful methods.

Aug Control flow ● If statements allow one to selectively execute blocks of code. ● else statement can allow for binary decisions. ● elif statements should be used when choosing between lots of different possible exclusive choices. ● Loops allow one to repeat a bit of code. ● For a fixed number of times in the case of a for loop. ● Until some condition is true for a while loop.

Aug Structure of Programming ● Functions ● Used to chuck code into easy to understand bits. ● Used to avoid repeating code. ● Can return a value if it is specified. ● Otherwise return none. ● Modules ● Used to group related functions together. ● Names can be reused across modules.

Aug Structure of Programming ● Classes ● Essentially user-made types. ● Classes have their own variables and methods. ● Inheritance allows for easy extendability of code. ● The class methods should be like a user manual for the class.

Aug Meta-Programming ● Testing and Code Design ● Tied together. ● Thinking of one should influence the other. ● At all points you should be thinking about how to test your code, and what those tests mean for your code design. ● Similarly, knowing your code design should help you think about tests. ● In general want to test 'generic behaviour' as well as 'corner cases'. ● Useful to design tests adversarially.

Aug Meta Programming ● Documentation. ● If one is writing code that will be used constantly, one should treat it as if one is writing code for someone else. ● Docstrings should contain type information. ● They should describe what a function/method does, but not how it does it. ● Modules/Classes should also have generic docstrings

Aug Meta Programming ● Algorithm Design and Complexity ● Algorithm design is the first step of solving a problem. ● Algorithms are usually fairly general, and so are judged by 'complexity' – a high-level sense of how the time to solve the problem scales with the input. ● Accurate time-measurements are used more for refinement of solutions than for generating them.

Aug Things that were covered at aren't on the final. ● Media ● Inheritance ● Exceptions.

Aug Where to go from here. ● Graphical User Interface(GUI) ● Really finicky. ● TKinter is a python module used to design guis. ● Choose a project ● Probably the best way to learn programming. ● You should have enough fundamentals to be able to look up modules online and use them. ● Default values ● Can make code cleaner.

Aug Where to go from here. ● Programming Courses. ● These will cover meta-programming skills – commonly used templates – commonly used data structures – common approaches to working within a group/organising large amounts of code. ● Theory Courses. ● Show the math of computer science. ● Give high level templates to generic problems. – These can be instantiated.

Aug Where to go from here. ● Online Resources ● Khan Academy – lectures ● Software Carpentry – lectures ● Codecademy – small problems that build off of eachother.

Aug Break

Aug Exam Overview