CIT 590 Intro to Programming Last lecture on Python.

Slides:



Advertisements
Similar presentations
CATHERINE AND ANNIE Python: Part 3. Intro to Loops Do you remember in Alice when you could use a loop to make a character perform an action multiple times?
Advertisements

Intro to CIT 594
CIT 590 Unit testing.
MR. WINGENBACH SOLHEIM ELEMENTARY SCHOOL 6 TH GRADE Guidelines and Procedures.
CIT 590 Intro to Programming Lecture 2. Agenda ints, floats, strings, booleans Conditionals Loops Functions Testing The concept of scope.
Important concepts in software engineering The tools to make it easy to apply common sense!
Slide 1 CS3 Fall 2005 Lecture week 13: Introduction to the Big Project.
26-Jun-15 Getting Ready for CIT Labs Lab is scheduled for 3;00-4:30 Fridays in Moore 207 Lab is not in Towne 309 (Registrar has it wrong) Everyone.
Programming Introduction November 9 Unit 7. What is Programming? Besides being a huge industry? Programming is the process used to write computer programs.
30-Jun-15 Getting Ready for CIT Labs Lab is scheduled for 1:30-3:00 Fridays in Moore 207 Lab is not in Towne 313 (Registrar has it wrong) Everyone.
(Edit via Slide Master) Name – Job Title From R to Python Robert Mastrodomenico Global Sports Statistics.
Unittest in five minutes Ray Toal How to unit test Not manually, that's for sure You write code that exercises your code Perform assertions.
CIT 590 Unit testing. Agenda Debugging attempt 2 (because I am stubborn) What is unit testing Why? Unit testing framework in Python.
Terms: Test (Case) vs. Test Suite
CSE 131 Computer Science 1 Module 1: (basics of Java)
CIT 590 Intro to Programming Last lecture on Python.
The preprocessor and the compilation process COP3275 – PROGRAMMING USING C DIEGO J. RIVERA-GUTIERREZ.
CS61A Lecture 2 Functions and Applicative Model of Computation Tom Magrino and Jon Kotker UC Berkeley EECS June 19, 2012.
TDD,BDD and Unit Testing in Ruby
1 Spidering the Web in Python CSC 161: The Art of Programming Prof. Henry Kautz 11/23/2009.
Welcome to CS 115! Introduction to Programming. Class URL Please write this down!
Welcome to the 3 rd Junior Session Prepared by Eslam Mohammed Diaa El-Din Twitter
CIT 590 Intro to Programming Style Classes. Remember to finish up findAllCISCourses.py.
Program Design CMSC 201. Motivation We’ve talked a lot about certain ‘good habits’ we’d like you guys to get in while writing code. There are two main.
CIT 590 Examples Debugging. Agenda This class is an experiment in letting students learn by just doing things as opposed to me talking all the time! So.
CS 350 – Software Design The Object Paradigm – Chapter 1 If you were tasked to write code to access a description of shapes that were stored in a database.
CS 114 – Class 02 Topics  Computer programs  Using the compiler Assignments  Read pages for Thursday.  We will go to the lab on Thursday.
Design Strategies 1: Combine Simpler Functions CS 5010 Program Design Paradigms “Bootcamp” Lesson © Mitchell Wand, This work is licensed.
CIT 590 Intro to Programming Lecture 4. Agenda Doubts from HW1 and HW2 Main function Break, quit, exit Function argument names, scope What is modularity!
CIT 590 Intro to Programming Lecture 12. Agenda More stuff with classes Few more thoughts on unit testing/coding in general Summarizing Python.
BIT 115: Introduction To Programming Instructor: Mike Panitz
Welcome to CS 115! Introduction to Programming. Class URL Write this down!
INTRODUCTION TO PROGRAMMING ISMAIL ABUMUHFOUZ | CS 146.
Introduction to Python Lesson 1 First Program. Learning Outcomes In this lesson the student will: 1.Learn some important facts about PC’s 2.Learn how.
6 September How Computers Work. Follow Ups VeriSign: : A Space.
Software Development. Software Development Loop Design  Programmers need a solid foundation before they start coding anything  Understand the task.
CPSC 873 John D. McGregor Session 9 Testing Vocabulary.
CPSC 871 John D. McGregor Module 8 Session 1 Testing.
CS12230 Introduction to Programming Lecture 6-2 –Errors and Exceptions 1.
CIT 590 Intro to Programming Lecture 4. How are assignments evaluated Pay attention to what the HW says it is trying to teach you about ‘modular programming’
Club Overview - Day 3 (Get Excited!!!!!). Agenda I. Video II. Log into Canvas III. Choosing a Level IV. Learning and Creating V. Free stuff! VI. Closing.
Agendas Agendas are extremely important for your child to be successful in the fifth grade. Students must have agendas at all times Miss Hargrave and I.
CIT 590 Intro to Programming Lecture 2. Agenda ‘import’ Abstraction Functions Testing The concept of scope.
Graphics Lab: MyPaint Dan Maselko 1. MyPaint Description  For this assignment you will be implementing a very simple paint program.  You should be able.
Today… Modularity, or Writing Functions. Winter 2016CISC101 - Prof. McLeod1.
PROBLEM SOLVING AND PROGRAMMING ISMAIL ABUMUHFOUZ | CS 170.
Computer Science I ISMAIL ABUMUHFOUZ | CS 180. CS 180 Description BRIEF SUMMARY: This course covers a study of the algorithmic approach and the object.
CPSC 372 John D. McGregor Module 8 Session 1 Testing.
CSC 108H: Introduction to Computer Programming Summer 2012 Marek Janicki.
CSC 108H: Introduction to Computer Programming
CS 5010 Program Design Paradigms “Bootcamp” Lesson 2.4
Software Development.
MET4750 Techniques for Earth System Modeling
John D. McGregor Session 9 Testing Vocabulary
Algorithmic complexity: Speed of algorithms
Self-Advocacy Mini Lesson
John D. McGregor Session 9 Testing Vocabulary
Week 1 Gates Introduction to Information Technology cosc 010 Week 1 Gates
Welcome to CS 1010! Algorithmic Problem Solving.
Welcome to CS 1010! Algorithmic Problem Solving.
John D. McGregor Session 9 Testing Vocabulary
Welcome to CS 1010! Algorithmic Problem Solving.
Algorithmic complexity: Speed of algorithms
Your code is not just…your code
CS305, HW1, Spring 2008 Evaluation Assignment
Algorithmic complexity: Speed of algorithms
Bryan Burlingame 24 April 2019
Your code is not just…your code
Unit Testing.
Welcome to Computer Science
Presentation transcript:

CIT 590 Intro to Programming Last lecture on Python

Logistics Review session this Friday in both lab sessions Come with questions Midterm on Monday I am out of town for a conference Tues eve - Friday Midterms handed out and midterm discussion on Wednesday Session led by TA(s) Setting up Eclipse. Have to make sure you can run HelloWorld.java before you leave for spring break

Agenda Wrap up Python A really brief insight into development of software Copy versus deepcopy Show you the power of Python modules (NOT PART OF MIDTERM)

More unit testing How do I write a test without having written any code? Best practice in industry is to write the method signature and say raise NotImplementedError modular programming = testable code Writing unit tests is actually almost like writing code. Write comments Write helper functions Sometimes the unit test file is bigger than the code file Do not hesitate to have a bunch of test cases If a test fails, it should be fairly obvious which function I need to go fix

How code is written (agile paradigm) PM comes with specs Make me a solitaire game Dev team sits and writes ‘user stories’ A user should be able to get a card from the deck A user should be able to move cards around Each move should be checked for ‘legality’ User story split up into tasks Now we start talking data structures/representation etc Maybe the tableau is a list of lists? Maybe the tableau is a dictionary top-down design Each dev looks at the list of functions they have to write Make a decision about which functionalities go together = class

How code is written (agile paradigm) Start writing stubs with something like raise NotImplementedError, return “TODO” Write unit tests for the simplest of those methods Watch unit test fail Write code to make unit test pass Repeat unit testing process Talk to other devs about the classes they are writing Stand up meeting every morning Hook the classes up together Write tests that test the integration - sometimes these tests are no longer in our unit test form. Front end tests, regression test suite, manual tests

Clarifications for Solitaire Make one Solitaire class That class should not inherit from Card or Deck Solitaire is not a Deck. Also Solitaire is not a Card This assignment is not an example of inheritance. More an example of what is called composition You should feel free to add more methods to Deck or Card if it makes sense Example of a bad method to put into Card def checkLegalMove(self, other) Example of a good method to put into Card (if you want) def has_same_suit(self, other)

Copy versus deepCopy import copy lst = [[1,2,3], [4,5,6], [7,8,9]] lst1 = copy.copy(lst) lst2 = copy.deepcopy(lst) lst.append([5]) lst[0].append(6) Copy only makes a ‘copy’ at the outermost level. Basically whenever you have list of lists or dictionaries that have lists inside them, you probably want deepCopy.

LoudCrowd time

lst = [1, 2, 3, 4] dct = {‘a’ : 1, ‘b’ : 2, ‘c’ : 3, ‘d’ : 4} What is the end result of the following lines of code? vals = dct.values() vals.sort() S = lst + vals X = sum(S) What is the value of X?

a) grandparent parent 16 b) parent grandparent 16 c) parent grandparent 17 d) error e) grandparent parent 17

reduce(lambda x,y: x%2 + y%2,map(lambda x: x + 3, 5/2 * [1,2,3]))

The power of Python libraries Most anything in Python has already been implemented in some manner import ….. import antigravity On a more serious note we will talk a bit about 3 packages – numPy, sciPy, beautifulSoup

How to install packages Supposedly easier on mac/linux machine - only windows Install pip windows windows Once you have pip installed a lot of packages can be installed by just simply typing pip install some-package-name

Numpy and Scipy Matlab/R? Once you import numpy and scipy, Python can be used to math computations just as easily as matlab/R You now get access to a bunch of numerical methods numpydemo.py has some really basic stuff >>> import numpy as np >>> a = np.array([[3,1], [1,2]]) >>> b = np.array([9,8]) >>> solution = np.linalg.solve(a, b)

Beautiful soup Real cool module for scraping data from the web It basically does parsing of the html and also allows for CSS selectors to be used

What do I do next with Python? If you are interesting in understanding linguistics from a CS perspective (computational linguistics) Data science Use it in a hackathon! Get good at it and work at Youtube (umm Google)

Post midterm