New User Special Price Expires in

Let's log you in.

Sign in with Facebook


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


Create a StudySoup account

Be part of our community, it's free to join!

Sign up with Facebook


Create your account
By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here

Programming, Week 4

by: Priya

Programming, Week 4 CSIS 153

Minnesota State University Moorhead
GPA 3.06

Preview These Notes for FREE

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

Unlock Preview
Unlock Preview

Preview these materials now for free

Why put in your email? Get access to more of this material and other relevant free materials for your school

View Preview

About this Document

Notes about Lists (python language)
Introduction to Computers and Programming I-b
Dr. Ficek
Class Notes
25 ?




Popular in Introduction to Computers and Programming I-b

Popular in Information And Computer Science

This 2 page Class Notes was uploaded by Priya on Friday September 16, 2016. The Class Notes belongs to CSIS 153 at Minnesota State University Moorhead taught by Dr. Ficek in Fall 2016. Since its upload, it has received 9 views. For similar materials see Introduction to Computers and Programming I-b in Information And Computer Science at Minnesota State University Moorhead.


Reviews for Programming, Week 4


Report this Material


What is Karma?


Karma is the currency of StudySoup.

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

Date Created: 09/16/16
Add list myList.append(someItem) myList.insert(posBeforeWhich, someItem) Create an empty list myList = [ ] or myList = list() # constructor Print all items in a list For item in myList: Print(item) Or numItems = len(myList) for ct in range(numItems): print( myList[ct] ) Check for an item in the list itemToLookFor = input(“enter element to find: “) #convert if necessary If itemTo LookFor in myList: Print(“found it”) Else: Print(“item not found”) Delete an item from the list --- NOT METHOD Del myList[positionOfItemToBeDeleted] myList=[] del myList[#] print(myList) #strings Tmpst.isdigit() Returns true if all characters in string are .ialplha() digits .isalnum() Checks if string consists of alphabetic .isupper() characters only .islower() All alphanumeric no spaces .capitalize() Makes all letters uppercase newList = tmpStr.split() #not mutator Makes all letters lowercase #always returns a list Only first letter uppercase =tmpStr.rstrip() List of all words in string =tmpStr.lstrip() =tmpStr.strip() Returns copy of string with all characters #FUNCTION stripped at end newList = sorted(myList) ‘’ ‘’ but from beginning of sentence Stripped beginning and end The 3 types of methods: Constructor, Mutator, Accessor functions: Max, min, len, sum, sorted *List methods: myList.append(el) myList.sort() #mutator method myList.sort(reverse=True #sorts highest to lowest) #mutator method myList.insert(posBefore, el) myList.reverse() ) # does a 180 *Retrieves one item out of the list: use index myList = [10,20,30,40] myList.append(100) # puts 100 at the end of the list #append is mutator method print(myList[3:]) # prints sc = myList[#] #number sc = myList[-1] # gives 40 grpSc = myList[2:4] #slice sc = myList[0] #grabs the 10 grp = myList[1:] #from second el to end *Print a list using element for el in myList: # prints one number in each line #iterator print(el) for el in myList: print(el, end=” “) for ct in range(0, len(myList), 1): #another way to print one number in each line print( , myList[ct]) *Want to print 1. 10 2. 20 3. 30 for ct in range(0, len(myList), 1): print(ct+1, “.”, myList[ct]) *strings: stuList = [ [“joe”, 3.5] , [“sally”, 4.0], [“jim”, 2.5] ] name = input (“enter a gpa:”)) gpa = float (input(“enter a gpa:”)) oneStuInfoList = [name,gpa] stuList.append( oneStuInfoList) # adds number into list tot = 0 # prints the average for subList in stuList: tot += subList[1] avg = tot / len(stuList) for sublist in stuList: # prints just the gpa’s print(subList[1] )


Buy Material

Are you sure you want to buy this material for

25 Karma

Buy Material

BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.


You're already Subscribed!

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

Bentley McCaw University of Florida

"I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"

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!"

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."

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


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


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:

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

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.