×

### Let's log you in.

or

Don't have a StudySoup account? Create one here!

×

or

by: Eunice

15

0

2

# Week 8 Notes CS 1110-002

Eunice
Cornell

Get a free preview of these Notes, just enter your email below.

×
Unlock Preview

Introducing Lists Methods Void vs. Fruitful
COURSE
Intro to Computing using Python
PROF.
Lee, Van Loan
TYPE
Class Notes
PAGES
2
WORDS
CONCEPTS
Python, CS
KARMA
25 ?

## Popular in ComputerScienence

This 2 page Class Notes was uploaded by Eunice on Saturday March 19, 2016. The Class Notes belongs to CS 1110-002 at Cornell University taught by Lee, Van Loan in Spring 2016. Since its upload, it has received 15 views. For similar materials see Intro to Computing using Python in ComputerScienence at Cornell University.

×

## Reviews for Week 8 Notes

×

×

### What is Karma?

#### You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 03/19/16
CS 1110 Van Loan and Lee Spring 2016 March 15, 2016: Prelim 1 Review March 17, 2016  Lists of Numbers o previously seen in the triplet of numbers that is the rgb encoding of a color (length 3 list) o Terminology: “x=[1,2,3,4,5]”: x holds all those values  2 is an item, entry, element, value in the list x  n=len(x)=5  a=x[2]  a subscript is used to access an entry  can be sliced like a string (lists are similar to strings but with distinct differences)  string: sequence of characters  list: sequence of numbers (or lists of strings or lists of object (this will be learned later)) o differences: list vs. strings  strings are immutable (unchangeable)  lists are mutable (changeable)  can replace a single value or a slice  List Methods o like count, find, replace (string methods) o dot notation o append, extend, insert, sort  x.append(#)  add the # value to the end of the list  t=[#,##]  x.extend(t)  append t  i=some index number  a=#  x.insert(i,a)  insert value of a at index i  x.sort()  sort in a manner (like little to big)  default argument is False  to reverse: “x.sort(reverse=True)”  Void vs. Fruitful Methods o Void  void methods return the value of None (they don’t return anything)  list methods are void  ex.  “y=x.method()  print y  None” o Fruitful  pop  i = index number  m = x.pop(i)  removes the value from that string (which shortens the length)  count  m=x.count(#)  returns the number of # in the list  two available functions (built-in): len and sum  don’t use dot notation  sum is like concatenating/extending o if you multiply a list, it’s like extending it three times  Setting up Lists o short lists are bracketed with commas  A function that returns a list

×

×

### BOOM! Enjoy Your Free Notes!

×

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

## Why people love StudySoup

Steve Martinelli UC Los Angeles

#### "There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."

Allison Fischer University of Alabama

#### "I signed up to be an Elite Notetaker with 2 of my sorority sisters this semester. We just posted our notes weekly and were each making over \$600 per month. I LOVE StudySoup!"

Jim McGreen Ohio University

#### "Knowing I can count on the Elite Notetaker in my class allows me to focus on what the professor is saying instead of just scribbling notes the whole time and falling behind."

Parker Thompson 500 Startups

#### "It's a great way for students to improve their educational experience and it seemed like a product that everybody wants, so all the people participating are winning."

Become an Elite Notetaker and start selling your notes online!
×

### Refund Policy

#### STUDYSOUP CANCELLATION POLICY

All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email support@studysoup.com

#### STUDYSOUP REFUND POLICY

StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here: support@studysoup.com

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to support@studysoup.com