Nate Brunelle Today: Style, Collections

Slides:



Advertisements
Similar presentations
ThinkPython Ch. 10 CS104 Students o CS104 n Prof. Norman.
Advertisements

I210 review Fall 2011, IUB. Python is High-level programming –High-level versus machine language Interpreted Language –Interpreted versus compiled 2.
DICTIONARIES. The Compound Sequence Data Types All of the compound data types we have studies in detail so far – strings – lists – Tuples They are sequence.
Lilian Blot CORE ELEMENTS COLLECTIONS & REPETITION Lecture 4 Autumn 2014 TPOP 1.
October 4, 2005ICP: Chapter 4: For Loops, Strings, and Tuples 1 Introduction to Computer Programming Chapter 4: For Loops, Strings, and Tuples Michael.
Chapter 8 More On Functions. "The Practice of Computing Using Python", Punch & Enbody, Copyright © 2013 Pearson Education, Inc. First cut, scope.
Python Functions.
Introduction to Strings Intro to Computer Science CS1510, Section 2 Dr. Sarah Diesburg 1.
More Sequences. Review: String Sequences  Strings are sequences of characters so we can: Use an index to refer to an individual character: Use slices.
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’
CIT 590 Intro to Programming Lecture 4. Random utilities to improve efficiency Search everything! Beyond Compare Keyboard shortcuts Not essentially but.
CSC 108H: Introduction to Computer Programming Summer 2012 Marek Janicki.
CMSC201 Computer Science I for Majors Lecture 08 – Lists
Topic: Python Lists – Part 1
Sharing, mutability, and immutability
When to use Tuples instead of Lists
Intro To Pete Alonzi University of Virginia Library
Topic: Functions – Part 2
Section 6: Sequences Chapter 4 and 5.
CSC 108H: Introduction to Computer Programming
String Manipulation.
Sharing, mutability, and immutability
CISC101 Reminders Quiz 2 this week.
Introduction to Strings
Lists in Python.
Nate Brunelle Today: Repetition, A Trip To The Moon
Lesson 09: Lists Topic: Introduction to Programming, Zybook Ch 8, P4E Ch 8. Slides on website.
Sharing, mutability, and immutability
Nate Brunelle Today: Repetition, Repetition
Nate Brunelle Today: Slicing, Debugging, Style
CISC101 Reminders Quiz 1 grading underway Next Quiz, next week.
Comparing Strings – How to
Intro to Programming Lecture 3
CS 1111 Introduction to Programming Fall 2018
Nate Brunelle Today: Functions again, Scope
Sharing, mutability, and immutability
CEV208 Computer Programming
Lesson 09: Lists Class Chat: Attendance: Participation
Nate Brunelle Today: Turtles
Nate Brunelle Today: Conditional Decision Statements
Sharing, mutability, and immutability
Michael Ernst CSE 140 University of Washington
Nate Brunelle Today: Lists
Introduction to Strings
Nate Brunelle Today: Dictionaries
Reference semantics, variables and names
(more) Python.
LING 408/508: Computational Techniques for Linguists
Nate Brunelle Today: Functions
CS 1111 Introduction to Programming Spring 2019
CS1110 Today: collections.
Nate Brunelle Today: Strings, Type Casting
Nate Brunelle Today: Values and Types
CISC101 Reminders Assignment 2 due today.
CHAPTER 4: Lists, Tuples and Dictionaries
CS2911 Week 2, Class 3 Today Return Lab 2 and Quiz 1
Introduction to Strings
Nate Brunelle Today: Dictionaries
Nate Brunelle Today: Conditional Decision Statements
Winter 2019 CISC101 5/26/2019 CISC101 Reminders
Gavin Restifo March 1, 2019 Today: Repetition Part 2 - For Loops
Nate Brunelle Today: Regular Expressions
Nate Brunelle Today: Functions
Nate Brunelle Today: Strings, Type Casting
Nate Brunelle Today: Functions again, Scope
Nate Brunelle Today: Regular Expressions
Introduction to Strings
Nate Brunelle Today: Pseudo-Code
Constants, Variables and Data Types
Tuple.
Presentation transcript:

Nate Brunelle Today: Style, Collections CS1110 Nate Brunelle Today: Style, Collections

Questions?

Last Time Debugging Slicing

Style You should write code to be read by humans Docstrings Names Pep8 Have information at beginning of functions to describe what it does Names A name should describe the meaning Can be hard Make sure there is one meaning per variable Pep8 Other Python style guidelines Talks about things that aren’t names or docstrings, but make code ugly

Collections Order doesn’t matter, No Repetition Order Matters, Repetition ok Examples: String List Tuple Range Counting starts at 0 collection[index] gives a specific value in the collection Order doesn’t matter, No Repetition Examples: Set Dict

Ordered Collections Collection What it can hold Syntax to create Mutable? String characters ‘’ immutable Range ints range Tuple Anything ( , ) List [ , ] mutable

Methods that Mutate Lists append(element) remove(element) pop(i)