×

Let's log you in.

or

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

×

or

by: Priya

9

1

2

Programming, Week 4 CSIS 153

Priya
GPA 3.06

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

×
Unlock Preview

COURSE
Introduction to Computers and Programming I-b
PROF.
Dr. Ficek
TYPE
Class Notes
PAGES
2
WORDS
CONCEPTS
programming
KARMA
25 ?

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

×

×

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: 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] )

×

25 Karma

×

×

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

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