EECS 110: Lec 2: What is Programming? Aleksandar Kuzmanovic Northwestern University

Slides:



Advertisements
Similar presentations
Mon: CS + programming Tue: Data Wed: Algorithms
Advertisements

Python Basics: Statements Expressions Loops Strings Functions.
EECS 110: Recitation #1: Ionut Trestian Northwestern University
EECS 110: Lec 14: Classes and Objects Aleksandar Kuzmanovic Northwestern University
ECS 15 if and random. Topic  Testing user input using if statements  Truth and falsehood in Python  Getting random numbers.
Python Programming Chapter 1: The way of the program Saad Bani Mohammad Department of Computer Science Al al-Bayt University 1 st 2011/2012.
Genome Sciences 373 Genome Informatics Quiz Section #1 March 31, 2015.
PYTHON: LESSON 1 Catherine and Annie. WHAT IS PYTHON ANYWAY?  Python is a programming language.  But what’s a programming language?  It’s a language.
EECS 110: Introduction to Programming for Non-Majors
Welcome to IS 313 ! When the course was over, I knew it was a good thing. We don't have strong enough words to describe this class. Information Technology.
Welcome (back) to IST 338 ! Homework 0 Problem 0: Already complete!
Welcome to CS 5 ! Introduction to CS an advocate of concrete computing When the course was over, I knew it was a good thing. We don't have strong enough.
EECS 110: Lec 2: What is Programming?
ICAPRG301A Week 4Buggy Programming ICAPRG301A Apply introductory programming techniques Program Bugs US Navy Admiral Grace Hopper is often credited with.
Introduction to Programming Peggy Batchelor.
Python – Making Decisions Lecture 02. Control Structures A program that only has one flow is useful but limited. We can use if statements to make these.
CS != programming What is computer science (CS)? Take CS 121.
PYTHON: PART 2 Catherine and Annie. VARIABLES  That last program was a little simple. You probably want something a little more challenging.  Let’s.
COMPUTER PROGRAMMING. Control Structures A program is usually not limited to a linear sequence of instructions. During its process it may repeat code.
Computer Science 101 Introduction to Programming.
Getting Started with MATLAB 1. Fundamentals of MATLAB 2. Different Windows of MATLAB 1.
Conditions. Objectives  Understanding what altering the flow of control does on programs and being able to apply thee to design code  Look at why indentation.
Hey, Ferb, I know what we’re gonna do today! Aims: Use formatted printing. Use the “while” loop. Understand functions. Objectives: All: Understand and.
Setting up and getting going with…. MIT App Inventor.
ISU Basic SAS commands Laboratory No. 1 Computer Techniques for Biological Research Animal Science 500 Ken Stalder, Professor Department of Animal Science.
EECS 110: Lec 3: Data Aleksandar Kuzmanovic Northwestern University
Intro Python: Variables, Indexing, Numbers, Strings.
USING UNITY JAVASCRIPT. CONVENTIONS AND SYNTAX IN JAVASCRIPT Case Sensitivity All keywords like var or function must be in lowercase. All variable names,
Intro to Python Adriane Huber Debbie Bartlett Python Lab #1Python Lab #1 1.
COMP 171: Data Types John Barr. Review - What is Computer Science? Problem Solving  Recognizing Patterns  If you can find a pattern in the way you solve.
EECS 110: Introduction to Programming for Non-Majors Aleksandar Kuzmanovic Northwestern University
PROGRAMMING In. Objectives  We’re learning to develop basic code with the use of the correct syntax and variables. Outcomes  Explain what syntax is.
Programming for GCSE 1.0 Beginning with Python T eaching L ondon C omputing Margaret Derrington KCL Easter 2014.
OCR Computing GCSE © Hodder Education 2013 Slide 1 OCR GCSE Computing Python programming 4: Writing programs.
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.
1 Printing in Python Every program needs to do some output This is usually to the screen (shell window) Later we’ll see graphics windows and external files.
EECS 110: Lec 3: Data Aleksandar Kuzmanovic Northwestern University
EECS 110: Introduction to Programming for Non-Majors Aleksandar Kuzmanovic Northwestern University
EECS 110: Lec 7: Program Planning Aleksandar Kuzmanovic Northwestern University
Picobot area already covered area not covered (yet!) inspiration? walls Goal: whole-environment coverage with only local sensing … Picobot as envisioned.
Python Lesson 1 1. Starter Create the following Excel spreadsheet and complete the calculations using formulae: 2 Add A1 and B1 A2 minus B2 A3 times B3.
1. COMPUTERS AND PROGRAMS Rocky K. C. Chang September 6, 2015 (Adapted from John Zelle’s slides)
EECS 110: Lec 3: Data Aleksandar Kuzmanovic Northwestern University
CS 177 Recitation Week 1 – Intro to Java. Questions?
Alice and Java Unit 7 1. Day 1  Objective: Gain an introduction to Java and Eclipse  Essential skill: DM-1: Use technology to advance critical thinking.
Part 1 Learning Objectives To understand that variables are a temporary named location to store data and that programmers work with different data types.
PROBLEM SOLVING WARM-UP Fill in the spaces using any operation to solve the following (!, (), -/+,÷,×): = 6.
Development Environment
Whatcha doin'? Aims: To start using Python. To understand loops.
CSCI 203: Introduction to Computer Science I
EECS 110: Introduction to Programming for Non-Majors
Roomba! Goal: whole-environment coverage Problem motivation
Introduction to Python
Aleksandar Kuzmanovic Northwestern University
EECS 110: Lec 2: What is Programming?
What is computer science (CS)?
Today’s lesson – Python next steps
Learning Outcomes –Lesson 4
Introduction to Programming
Picobot Challenge! inspiration? walls Picobot area not covered (yet!)
Beginning Python Programming
12th Computer Science – Unit 5
Introduction to Programming
Starter Which of these inventions is: Used most by people in Britain
CS Problem Solving and Object Oriented Programming Spring 2019
EE 194/BIO 196: Modeling biological systems
CSCI 203: Introduction to Computer Science I
Roomba! Goal: whole-environment coverage Problem motivation
Ionut Trestian Northwestern University
PYTHON - VARIABLES AND OPERATORS
Presentation transcript:

EECS 110: Lec 2: What is Programming? Aleksandar Kuzmanovic Northwestern University

CS != programming What is computer science (CS)? Take EECS 101

CS != programming What is computer science (CS)? Take EECS 101 "not equal to"

4 Programming CS a vehicle, not a destination programming : CS :: machining : engineering grammar : literature equations : mathematics CS != programming

CS == computing science Study of complexity (or complex things?) How can it be done? How well can it be done? Can it be done at all?

CS == computing science Study of complexity (or complex things?) How can it be done? How well can it be done? Can it be done at all? "equal to"

Information What information does Google work with? What technical problems does Google face?

Information What information does Facebook work with? What technical problems does Facebook face?

Information What information does the iPhone work with? What technical problems does the iPhone face?

Computer Science and Information Information is life’s fundamental building block CS is a set of fundamental techniques for understanding and leveraging this information 10

Python and Idle 11 Editor window: code Shell window: running code Here, you can try things out at the command prompt >>> Here, you can save and change programs. Hitting F5 runs your program over in the shell

If statements (1) 12 name = raw_input('Hi... what is your name? ') if name == 'Ionut': # is it Ionut? print 'x1' else: # in all other cases... print 'x2' print 'x3' hw0pr1.py Homework 0, problem 1

If statements (2) 13 name = raw_input('Hi... what is your name? ') if name == 'Ionut‘: print 'x1' else: print 'x2' print 'x3'

If statements (3) 14 name = raw_input('Hi... what is your name? ') if name == 'Ionut': # is it Ionut? print 'x1' elif name == 'Aleksandar': print 'x2' else: # in all other cases... print 'x3' print 'x4' hw0pr1.py Homework 0, problem 1

If statements (4) 15 name = raw_input('Hi... what is your name? ') if name == 'Ionut': print 'x1' elif name == 'Aleksandar': print 'x2' else: print 'x3' print 'x4'

If statements (5) 16 name = raw_input('Hi... what is your name? ') if name == 'Ionut': # is it Ionut? print 'x1' elif name == 'Aleksandar': print 'x2' elif name == ‘Lisa': print 'x3' else: # in all other cases... print 'x4' print 'x5' hw0pr1.py Homework 0, problem 1

If statements (6) 17 name = raw_input('Hi... what is your name? ') if name == 'Ionut‘: print 'x1' elif name == 'Aleksandar’: print 'x2' elif name == 'Lisa': print 'x3' else: print 'x4' print 'x5'

What is programming? 18 Programming as learning a foreign language 1) Expect it to be different! 2) Don’t feel you need to memorize it 3) Immersion == Experimentation

The foreign language of Python… 19 syntax? How it looks semantics? What it does intent? What it should do name = raw_input('Hi... what is your name? ') print # prints a blank line if name == 'Ionut': # is it Ionut? print name, '??' print ‘You must be a TA!' elif name == ‘Aleksandar’: # is it Aleksandar? print ‘You must be an instructor!' else: # in all other cases... print 'Welcome to Python,', name, '!'

The foreign language of Python… 20 syntax? How it looks semantics? What it does intent? What it should do name = raw_input('Hi... what is your name? ') print # prints a blank line if name == 'Ionut': # is it Ionut? print name, '??' print ‘You must be a TA!' elif name == ‘Aleksandar’: # is it Aleksandar? print ‘You must be an instructor!' else: # in all other cases... print 'Welcome to Python,', name, '!'

The foreign language of Python 21 syntax? How it looks semantics? What it does intent? What it should do how punctuation is used the language keywords that are used use of whitespace peculiarities of formatting how behavior is affected …

HW 0, Problem 2 22 syntax? How it looks semantics? What it does intent? What it should do Save hw0pr1.py under a new name, hw0pr2.py Change hw0pr2.py to play rock-paper-scissors. It does not have to play fair! Feel free to add to the dialog, if you wish… Submit your hw0pr2.py in the usual way. Stepping back from Python for a moment…

Homework problems 3 and 4 23 Picobot area not covered (yet!) Picobot walls area already covered Goal: whole-environment coverage with only local sensing … inspiration?

Picobot 24 area not covered (yet!) Goal: whole-environment coverage with only local sensing … area already covered Picobot walls iRobot's Roomba vacuum inspiration!

Surroundings 25 N W E S Picobot can only sense things directly to the N, E, W, and S For example, here its surroundings are NxWxNxWx N E W S Surroundings are always in NEWS order.

How many distinct surroundings are there? N E W S xxxxNxxxxExxxxWxxxxSNExxNxWxNxxS xEWxxExSxxWSNEWxNExSNxWSxEWSNEWS (won’t happen) == 16 possible … 2424 Surroundings

State Picobot's memory is a single number, called its state. State is the internal context of computation. State and surroundings represent everything the robot knows about the world Picobot always starts in state 0. I am in state 0. My surroundings are xxWS.

Rules Picobot moves according to a set of rules: state I am in state 0. My surroundings are xxWS. surroundings 0 xxWS 0N directionnew state If I'm in state 0 seeing xxWS, Then I move N orth, and change to state 0. Aha! I should move N. I should enter state 0.

Wildcards Asterisks * are wild cards. They match walls or empty space: 0 x*** 0N statesurroundingsdirectionnew state here, EWS may be wall or empty space I am in state 0. My surroundings are xxWS. Aha! This matches x***

What will this set of rules do to Picobot? 0 x*** 0N 0 N*** 1X 1 ***x 1S 1 ***S 0X statesurroundingsdirectionnew state Picobot checks its rules from the top each time. Only one rule is allowed per state and surroundings. When it finds a matching rule, that rule runs. ->

To do Write rules that will always cover these two rooms. (separate sets of rules are encouraged…) but your rules should work regardless of Picobot's starting location hw0, Problem #3 hw0, Problem #4 (Extra)

Alter these "up & down" rules so that Picobot will traverse the empty room… the empty room

Ideas for the maze? the maze