Introduction to: Computers & Programming: Review for Midterm 2



Similar documents
Management Information Systems 260 Web Programming Fall 2006 (CRN: 42459)

COMPSCI 105 S2 C - Assignment 2 Due date: Friday, 23 rd October 7pm

Introduction to Python

Curriculum Map. Discipline: Computer Science Course: C++

PIC 10A. Lecture 7: Graphics II and intro to the if statement

Computer Science for San Francisco Youth

RARITAN VALLEY COMMUNITY COLLEGE COURSE OUTLINE. CISY 103 Computer Concepts and Programming

Computers. An Introduction to Programming with Python. Programming Languages. Programs and Programming. CCHSG Visit June Dr.-Ing.

Sources: On the Web: Slides will be available on:

CS 1133, LAB 2: FUNCTIONS AND TESTING

River Dell Regional School District. Computer Programming with Python Curriculum

How To Play The Math Game

Outline. multiple choice quiz bottom-up design. the modules main program: quiz.py namespaces in Python

What makes a good coder and technology user at Mountfields Lodge School?

Some programming experience in a high-level structured programming language is recommended.

Computer Programming I

Python Lists and Loops

Introduction to: Computers & Programming: Input and Output (IO)

Oracle Database: SQL and PL/SQL Fundamentals

CSC 221: Computer Programming I. Fall 2011

Oracle SQL. Course Summary. Duration. Objectives

CS177 MIDTERM 2 PRACTICE EXAM SOLUTION. Name: Student ID:

WESTMORELAND COUNTY PUBLIC SCHOOLS Integrated Instructional Pacing Guide and Checklist Computer Math

USC VITERBI SCHOOL OF ENGINEERING INFORMATICS PROGRAM

Exercise 4 Learning Python language fundamentals

Introduction to Computer Science I Spring 2014 Mid-term exam Solutions

GET 114 Computer Programming Course Outline. Contact: Office Hours: TBD (or by appointment)

CS 2302 Data Structures Spring 2015

Microsoft Windows PowerShell v2 For Administrators

Introduction to Programming System Design. CSCI 455x (4 Units)

Oracle Database: SQL and PL/SQL Fundamentals NEW

Intelligent Learning and Analysis Systems: Data Mining and Knowledge Discovery Prof. Dr. Stefan Wrobel; Dr. Tamas Horvath

Create AKINDI Courses In AKINDI, create an AKINDI course for each section you teach. STUDENTS TAKE TEST VIEW RESULTS AND ADDRESS EXCEPTIONS

Game Programming & Game Design

CS 170 Java Programming 1. Welcome to CS 170. All about CS 170 The CS 170 Online Materials Java Mechanics: Your First Program

Oracle Database: SQL and PL/SQL Fundamentals

Beginning to Program Python

Python Programming: An Introduction To Computer Science

NEW YORK CITY COLLEGE OF TECHNOLOGY/CUNY Computer Systems Technology Department. COURSE: CST2403 C++ Programming Part 1 ( 4 hours, 3 credits )

Arithmetic Coding: Introduction

Computer Science 1 CSci 1100 Lecture 3 Python Functions

Python Programming: An Introduction to Computer Science

CS 2112 Spring Instructions. Assignment 3 Data Structures and Web Filtering. 0.1 Grading. 0.2 Partners. 0.3 Restrictions

AACSB Annual Assessment Report For

TECHNOLOGY Computer Programming II Grade: 9-12 Standard 2: Technology and Society Interaction

El Dorado Union High School District Educational Services

Visual Basic Programming. An Introduction

Intro to scientific programming (with Python) Pietro Berkes, Brandeis University

Introduction to Using SPSS Command Files

Video Game Programming ITP 380 (4 Units)

SPSS: Getting Started. For Windows

PRI-(BASIC2) Preliminary Reference Information Mod date 3. Jun. 2015

We will learn the Python programming language. Why? Because it is easy to learn and many people write programs in Python so we can share.

Query-by-Example (QBE)

02-201: Programming for Scientists

Project #2: Secure System Due: Tues, November 29 th in class

Objectives. Python Programming: An Introduction to Computer Science. Lab 01. What we ll learn in this class

Internet and Intranet Protocols and Applications

Weekly Schedule Lesson Plan

Big Data & Scripting Part II Streaming Algorithms

Course Content Concepts

El Dorado Union High School District Educational Services

Avsoft, Inc. LEARNING MANAGEMENT SYSTEM ORGANIZATION MANAGER MANUAL

Student Achievement and Satisfaction in Introductory Psychology: No Significant Differences Between Face- to- Face and Hybrid Sections

MAT 151 College Algebra and MAT 182 Trigonometry Course Syllabus Spring 2014

Goal: Practice writing pseudocode and understand how pseudocode translates to real code.

Python for Rookies. Example Examination Paper

Random Fibonacci-type Sequences in Online Gambling

ARIZONA CTE CAREER PREPARATION STANDARDS & MEASUREMENT CRITERIA SOFTWARE DEVELOPMENT,

Computer Science 217

COS Course Assessment Student Responses

2. The scanner examines the scanned data to determine if the barcode represents an XL Type I command or not. In Pseudo-Code:

LAGUARDIA COMMUNITY COLLEGE CITY UNIVERSITY OF NEW YORK DEPARTMENT OF MATHEMATICS, ENGINEERING, AND COMPUTER SCIENCE

Python Programming: An Introduction to Computer Science

Algorithms Abstraction

WebSphere Commerce V7 Feature Pack 2

New York University Stern School of Business Undergraduate College

PL/SQL MOCK TEST PL/SQL MOCK TEST I

Oracle Database 10g: Introduction to SQL

Discrete Math in Computer Science Homework 7 Solutions (Max Points: 80)

Introduction to SQL for Data Scientists

Lecture 9. Semantic Analysis Scoping and Symbol Table

Assuring flexibility to educational platforms Case study: UniBuc Virtual Campus

Iteration CHAPTER 6. Topic Summary

Design of Expanded Assessment Management System for Open-Source Moodle LMS Module

Program Your Own Game

Welcome to Introduction to programming in Python

Outline. NP-completeness. When is a problem easy? When is a problem hard? Today. Euler Circuits

1 Introduction. 2 Overview of the Tool. Program Visualization Tool for Educational Code Analysis

Government of Russian Federation. Faculty of Computer Science School of Data Analysis and Artificial Intelligence

Mobile App Design Project #1 Java Boot Camp: Design Model for Chutes and Ladders Board Game

How do sort this list using one line? a_list.sort()

Experiment 8: Entry and Equilibrium Dynamics

Chapter 1 Learning to Program With Alice

Transcription:

Introduction to: Computers & Programming: Adam Meyers New York University

Summary Some Procedural Matters Summary of what you need to Know For the Test and To Go Further in the Class The Practice Midterm (and Last Semester's Midterms)

Procedural Matters Regarding the Midterm The test is next class I will take attendance please bring your School ID The test will be graded on a curve The midterm counts for 20% of the final grade

Type of Questions that Could Be on the Test Section I: Answer questions about Code What is printed out? Look for print commands (sometimes include several rounds of interaction for a complex program) What value is returned by a function? Look for return commands What is the value of a certain variable Look at assignment statements (with =) Open ended questions: what does a function called by the main program do, e.g., checks if input is incorrect form What are the conditions that will cause the program to end? (look at if and while statements to figure out answer) Section II: Write functions that solve stated problems Read questions carefully Common errors involve misreading questions and writing functions that solve problems other than those stated in the question

What you should know Old Topics: algorithm, function, program, operator, input, output, side effect, variable, data types, if statements, else, decision trees, loops New Topics: Turtles, Strings, Lists and sequence operations Know old stuff from last midterm: define functions, assign values to variables; return values from functions and operators; use print statements, including the sep and end keywords; import modules; use data types and coerce one data type to another; write simple functions that work and are easy to understand, due to comments and variable/function names; if/elif/else statements and basic decision trees; use for loops and while loops; random numbers (just random.randint) New Stuff: turtle graphics (drawing lines, circles, turning left and right, putting the pen up and down, etc.); problems involving manipulating strings (slices, identifying characters by indices, building new strings using loops, etc.); lists (slices, identifying items by indices, changing parts of lists, using list.append, list.pop, list.reverse and various other list methods); using max, min and sort with lists, strings, characters, etc. Intro to: Computers & Programming

Functions Programming language Functions have 3 optional features: Input Output Side effects Input to a function via its parameters Using the input function to solicit interactive input from a user print versus return print is significant for its side effect printing to the computer screen return Exits block (function) Provides a value to a function call Example: If: function1(a) returns 5 and function2(b) returns 10 Then: function(a) + function(b) = 15

Turtle Graphics my_screen = turtle.screen() my_turtle = turtle.turtle() my_turtle.pu() my_turtle.pd() my_turtle.fd() my_turtle.left() my_turtle.circle() my_turtle.setposition(x,y)

Strings and Characters Characters: chr(number), ord(char), '\n', '\t', etc. Comparison with >,>=,<=,>=, e.g., 'Z'<'a' Indices and Slicing my_string = 'big bad wolf' my_string[0], my_string[-4], my_string[3:6], my_string[3:], my_string[:3], my_string[:], my_string[-4:], my_string[-4:-1] String operators, functions, methods len(string), string.reverse(),'abc'.upper(), 'AbC'.lower(),string1+string2 Comparison with >,>=,<,<=, e.g., 'Abc'>'ABc' Loops (for or while) with accumulator variables, e.g., def some_function(input_string): output = '' for char in input_string: output = output+change_char_in_some_way(char) return(output)

Indices and Slicing List1 = [1,2,3,4,5] list1[1:3] [2,3] list1[:3] [1,2] list1[1:] [2,3,4,5] Lists 1 list1[:] [1,2,3,4,5] (a copy of the original list) Functions/methods/operations that change list (mutability) list1.append(6) list1.extend([7,8,10]) list1.reverse() List1[0] = 9 ## list1 [9, 8, 7, 6, 5, 4, 3, 2, 1] list1.sort() ## list1 [1, 2, 3, 4, 5, 6, 7, 8, 9] list2 = [[5,'sandwich'],[2,'egg'],[10,'enchilada']] list2.sort() ## list2 [[2, 'egg'], [5, 'sandwich'], [10, 'enchilada']]

Lists 2 Comparisons with >,>=,<,<=, Max, Min, sort list2 = [[5,'sandwich'],[2,'egg'],[10,'enchilada']] list2.sort() ## list2 [[2, 'egg'], [5, 'sandwich'], [10, 'enchilada']] max(list2) [10,'enchilada'] [5,'sandwich']>[2,'egg'] loops with accumulator variables def make_derived_list(inlist): output = [] for item in in_list: output.append(derive_something_from(item)) return(output)

I will go over this in detail today Practice Midterm http://cs.nyu.edu/courses/spring16/-004/midterm2-practice.pdf http://cs.nyu.edu/courses/spring16/-004/midterm2-practice.py One of last term's midterm 2s are also online: http://cs.nyu.edu/courses/spring16/-004/midterm2-old.pdf http://cs.nyu.edu/courses/spring16/-004/midterm2-old.py Structure is the same as the midterm: 4 Part 1 questions 2 out of 3 Part 2 questions

Timing Time was an issue in Midterm 1, I am attempting to give you more time for this one. There are 4 rather than 5 questions in part There are tips included in Part 2 The practice test is designed to be a little harder than the real test, so if you can do that one on time, the real test should be OK There are 6 questions do be completed in 1:15 I suggest budgeting your time, e.g., 7 min X 4 part 1 questions = 28 min Skip part 1 questions that are too hard and go back to them later 15 min X 2 part 2 question = 30 min Extra time for going over budget: 17 minutes Intro to: Computers & Programming

Reminder: A Test is a Game Unfortunately, tests are imperfect for measuring a person's expertise because (independent of such expertise) some people know how to play the test game better than others How to win the test game Study sample test instructions Time is a crucial factor (you have 1 hour and fifteen minutes) Do easy problems before hard ones Do not spend a lot of time on low-point problems Do not get stuck on details that you don't need Solving all problems is more important than doing 1 problem elegantly Go for partial credit on program questions (most points) If you cannot program some detail write pseudo code Basic solution strategy is more important than perfect syntax

The Midterm is Next Class Please feel free to ask me any questions We will go over the practice midterm in class: ask questions Suggested Studying Methods Obvious look over previous class lectures, notes, homeworks, etc Practice problems of your choosing Look at previous tests from V22.0002 classes I taught My website: http://nlp.cs.nyu.edu/people/meyers.html V22.0002 was the old course number for this class Tests from V22.0002 websites should be helpful, although sometimes different material was covered. Looking at Midterm1 could be helpful both from this class and the other section, but keep in mind that this midterm will deal with additional material: 007 midterm 1: http://cs.nyu.edu/courses/fall15/-007/midterm1_version2.pdf Part1 answers: http://cs.nyu.edu/courses/fall15/-007/midterm1_version2.py 011 midterm 1: http://cs.nyu.edu/courses/fall15/-007/midterm1_version1.pdf Part1 answers: http://cs.nyu.edu/courses/fall15/-007/midterm1_version1.py Good luck! Intro to: Computers & Programming