Compsci 06/101, Fall 2010 3.1 Compsci 6/101: Sept 6-10 l We've looked at the language Python  Names and types: int, float, long, String, file, …  Operations:

Slides:



Advertisements
Similar presentations
Lecture 04 – Classes.  Python has a number of classes built-in  lists, dictionaries, sets, int, float, boolean, strings  We can define our own classes.
Advertisements

Python Programming: An Introduction to Computer Science
James Tam A High-Level Model For Software Development What is involved in the process of designing, writing and maintaining computer programs?
Reasons to study concepts of PL
COMP 14 Introduction to Programming Mr. Joshua Stough February 28, 2005 Monday/Wednesday 11:00-12:15 Peabody Hall 218.
Abstract Data Types (ADT)
Python November 18, Unit 7. So Far We can get user input We can create variables We can convert values from one type to another using functions We can.
Portability CPSC 315 – Programming Studio Spring 2008 Material from The Practice of Programming, by Pike and Kernighan.
Teaching Fellow Admissions Tutor for Computer Science Director of Undergraduate Studies.
1 CSC 221: Introduction to Programming Fall 2012 course overview  What did you set out to learn?  What did you actually learn?  Where do you go from.
Python Programming, 2/e1 Python Programming: An Introduction to Computer Science Chapter 2.
1 EMT 101 – Engineering Programming Dr. Farzad Ismail School of Aerospace Engineering Universiti Sains Malaysia Nibong Tebal Pulau Pinang Week 1.
Introduction to Programming Workshop 2 PHYS1101 Discovery Skills in Physics Dr. Nigel Dipper Room 125d
Compsci 101, Fall Plan for the week: Week 2, Sept 1-5 l Understanding program structure  Defining, testing, calling functions  How to run a.
1 CSC 221: Introduction to Programming Fall 2012 Functions & Modules  standard modules: math, random  Python documentation, help  user-defined functions,
Compsci 101.2, Fall PFTT (plan for this Thursday) l What is a Python program?  In the context of what we do in Compsci 101  In a neuroscience.
Procedures and Functions Computing Module 1. What is modular programming? Most programs written for companies will have thousands of lines of code. Most.
Compsci 06/101, Fall What will we do today? l Practice solving problems  Solving problems without a computer  Is this different than solving.
Compsci 101.2, Fall Plan For the Week l Solve problems by programming in Python  Like to do "real-world" problems, but we're very new to the.
Compsci 101.2, Fall PFThursday l Review Organization and Problem-Solving  Defining functions, calling functions  Return types, print, None l.
I Power Int 2 Computing Software Development High Level Language Constructs.
Oct 15, 2007Sprenkle - CS1111 Objectives Creating your own functions.
Compsci 06/101, Fall What will you do in Compsci 6 Today? l Learn about selection and if/else statements  In context of solving problems  Understanding.
Functions, Procedures, and Abstraction Dr. José M. Reyes Álamo.
Classes 1 COMPSCI 105 S Principles of Computer Science.
CompSci 101 Introduction to Computer Science September 23, 2014 Prof. Rodger.
1 CSC 321: Data Structures Fall 2013 See online syllabus (also available through BlueLine2): Course goals:  To understand.
CPSC 230 Computers and Programming I Spring 2003 Dr. Lynn Lambert.
Compsci 6/101, Spring More on Python, Tools, Compsci 101 l APTs, Assignments, Tools  APT: Algorithmic Problem-solving and Testing  How to get.
Compsci 6/101, Spring PFTW: Sequences aka Strings&Lists l From Return values to Random-ness [aka two R's]  What power does random provide? 
Compsci 101.2, Fall PFTWeek l Introduce new Python concepts  Control: if, elif, else, for  Data: Strings, Lists Operators on data: slicing,
Compsci 06/101, Fall Vocabulary l What's the Spanish word for 'boy'? 'eat'?  How do you know? l What about the Turkish equivalents?  How do.
CPS From sets, toward maps, via big-Oh l Consider the MemberCheck weekly problem  Find elements in common to two vectors  Alphabetize/sort resulting.
CSE 190p wrapup Michael Ernst CSE 190p University of Washington.
Methods of Software Development Karl Lieberherr Spring 2007.
Python Functions : chapter 3
FORTRAN History. FORTRAN - Interesting Facts n FORTRAN is the oldest Language actively in use today. n FORTRAN is still used for new software development.
Testing CSE 160 University of Washington 1. Testing Programming to analyze data is powerful It’s useless (or worse!) if the results are not correct Correctness.
Compsci 101, Fall Plan For The Day (PFTD) l Practice solving problems  Some solved with a computer, some with Python  Differences in solving.
Compsci 6/101, Spring WBFSB l Plan for this week  Get test back, review, look for problems/weaknesses  How to address these?  Assignments.
Introduction CSE 1310 – Introduction to Computers and Programming Vassilis Athitsos University of Texas at Arlington 1.
Compsci 101.2, Fall Plan for WEFWOO l Review for exam, studying and practicing for exams and APTs in Compsci 101  Why memorization doesn't help.
Compsci 6/101, Spring PFTW: Functions, Control, Python/Tools l How do functions work and why do we use them?  Functions we call (APIs), Functions.
Compsci 06/101, Spring Compsci 6: PFTW l Problem solving and (Python) programming  What are the steps in solving an APT?  How do you get better.
CompSci 101 Introduction to Computer Science February 4, 2016 Prof. Rodger compsci101 spring161.
Compsci 06/101, Spring This week in Compsci 6/101 l From sets to dictionaries  Incredibly powerful in solving problems  Power in Perl, Python,
OCR Computing GCSE © Hodder Education 2013 Slide 1 OCR GCSE Computing Python programming 3: Built-in functions.
CompSci 101 Introduction to Computer Science January 15, 2015 Prof. Rodger 1.
Machine Language Computer languages cannot be directly interpreted by the computer – they are not in binary. All commands need to be translated into binary.
Functions. What is a Function?  We have already used a few functions. Can you give some examples?  Some functions take a comma-separated list of arguments.
CompSci 101 Introduction to Computer Science February 5, 2015 Prof. Rodger Lecture given by Elizabeth Dowd compsci101 spring151.
CSC 222: Object-Oriented Programming
Types for Programs and Proofs
CompSci 101 Introduction to Computer Science
Testing UW CSE 160 Winter 2017.
CompSci 101 Introduction to Computer Science
CompSci 101 Introduction to Computer Science
CompSci 230 Software Construction
Testing UW CSE 160 Spring 2018.
CompSci 101 Introduction to Computer Science
Functions, Procedures, and Abstraction
Testing UW CSE 160 Winter 2016.
CISC101 Reminders Slides have changed from those posted last night…
CompSci 101 Introduction to Computer Science
Compsci 6/101: PFTW Review how APTs and Python work, run
Introduction to Computer Systems
CSC 321: Data Structures Fall 2018
More Basics of Python Common types of data we will work with
Functions, Procedures, and Abstraction
CMPT 120 Lecture 15 – Unit 3 – Graphics and Animation
Presentation transcript:

Compsci 06/101, Fall Compsci 6/101: Sept 6-10 l We've looked at the language Python  Names and types: int, float, long, String, file, …  Operations: *, +, -, /, %, ** l Types and values different from "real life"  What is 7/3 in Python?  What is "champion"[2:5]  What's String+String and String*int and String+int l For useful work: organizing code/programs  Functions, modules, indentation, naming

Compsci 06/101, Fall Functions: abstractions over code l Naming something gives you power  How do you find absolute value?  What is length of a string? l We can write and call functions  Re-use and/or modify  Store in module, import and re-use functions  Import standard modules and use functions from them l Functions can (should?) return a value  We've seen len return an int, what about file.read?  Other functions return Strings, floats, or other types

Compsci 06/101, Fall Anatomy of a Python function def name(params): body l Define a function, provide a name, provide parameters, provide a function body  How to decide on name?  Do we need parameters?  What does body of function do l Functions provide a named abstraction over code  Huh? What is math.isinf(..) or math.sqrt(..) ?

Compsci 06/101, Fall Design, Implementation, Testing l Designing Python code and functions  What do you want the code to do?  Other aspects of code, e.g., portability, efficiency, size, …  Understand how to solve a problem without computer l Implementing design in code  Translation of ideas into vocabulary of Python  We don't have a large vocabulary, but it will grow! l Testing code, functions  How do you know when function is right?  What confidence can testing provide?

Compsci 06/101, Fall Nancy Leveson: Software Safety l Mathematical and engineering aspects, invented the discipline  Air traffic control  Microsoft word There will always be another software bug; never trust human life solely on software. huffington post? l Therac 25: Radiation machine   l Software and steam engines Software and steam engines

Compsci 06/101, Fall Writing and testing functions l Review of slicing operator for strings  What is an index, where does indexing begin?  Value of s[a:b] compare s[a:] compare s[:b] l Review problems from last set of notes  Pounds to …, BMI, Heron's formula l Algorithm Problem Test (APT)  Role in Compsci 6/101 and other courses  Similar to Unit Testing, part of Agile Development

Compsci 06/101, Fall String functions in Python l Strings are objects, some functions 'builtin'  Use web, or Python: strip, startswith, find, count, …  Strings are immutable: "hello".replace("h","j") l Python operators/functions that work with strings  We've seen len, what about in? What's going on?  Slicing review, modify or create new? l Views of strings: what are they?  From an abstract point of view, from Pythonic POV?

Compsci 06/101, Fall Jon Kleinberg l 2005 MacArthur Fellow, 2008 Infosys Award, 2008 Discover “20 Best Brains under 40” l Networks course and book  Duke course 96 Spring 2010 l "....Try to keep an open mind about topics and areas going on....It's much easier to make progress on a problem when you are enjoying what you are doing. In addition to finding work that is important, find work that has some personal interest for you....I've benefited from a lot of mentoring throughout my career. I think it's important to pass it on to the next generation and work in a mentoring capacity or a teaching capacity with people entering the field....” ACM Infosys Interview