Data Structures 810:052 Python Collections - PowerPoint PPT Presentation

1 / 9
About This Presentation
Title:

Data Structures 810:052 Python Collections

Description:

Yesterday in my 'tutorial' I showed you the following method for printing: ... Concatenate a repeatd number of times. ListB * 3 [8, 9, 8, 9, 8, 9] Membership. in ... – PowerPoint PPT presentation

Number of Views:25
Avg rating:3.0/5.0
Slides: 10
Provided by: systema178
Category:

less

Transcript and Presenter's Notes

Title: Data Structures 810:052 Python Collections


1
Data Structures810052Python Collections
2
Getting Started
  • You were supposed to
  • Read through several sections of the textbook
  • Read the syllabus
  • Finish yesterdays lab
  • Any questions?

3
One quick observation
  • Yesterday in my tutorial I showed you the
    following method for printing
  • print The answer is str(answer)
  • print firstName lastName
  • Some of you started using this instead
  • print The answer is,str(answer)
  • print firstName , lastName
  • While this last one LOOKS preferable, Im going
    to strongly encourage you to follow my method
  • Problems arise later when you try to do file
    writing

4
Formatting Strings
  • But there is another way to do it. Rather than
    saying
  • print The area of a circle with a radius of
    radius is area
  • You might say
  • print The area of a circle with a radius of i
    is .2f (radius, area)

5
Suggestions before you go much further
  • Download and install python (version 2.5.4 is
    what is in the labs but 2.6.2 should work equally
    as well) on your home machine.
  • www.python.org
  • Obtain a copy of the python quick reference guide
    (60 pages)
  • rgruet.free.fr

6
Quick Review of Yesterday
  • Python has five basic date types
  • Integer - int()
  • Long - long()
  • Float - float()
  • String - str()
  • Boolean bool()
  • bool(0) -gt False
  • bool(1) - gt True
  • bool(78) -gt True

7
Moving on
  • Lists
  • Range
  • Iteration
  • Strings as lists
  • Tuples
  • Dictionary
  • And if time how python handles values in memory

8
Lists
  • A Python list is an ordered, mutable, collection
    of comma-separated values of any data type
    enclosed in square brackets
  • faculty Schafer , Fienup, East ,
    Drake
  • rhyme 1, 2, buckle, your , shoe
  • empty this is an empty list

9
Methods available to all collections
Write a Comment
User Comments (0)
About PowerShow.com