Artificial Intelligence Programming
Short Description
Artificial Intelligence. Programming. More Python. Chris Brooks. Department of Computer Science. University of San Francisco …
Website: www.cs.usfca.edu | Filesize: 218kb
Content
Artificial Intelligence
Programming
More Python
Chris Brooks
Department of Computer Science
University of San FranciscoList Comprehensions
Python has a great deal of support for functional
programming
This uses a built-in construct called a list
comprehension
List comprehensions are a convenient way to map a
function onto a sequence.
[x**2 for x in [1,2,3,4]]
phoneBook = {”brooks”:”422-5221”,
”wolber”:”422-1234”,”parr”:”422-3435”}
[”name: %s phone: %” % (nm, ph) for nm, ph in
phoneBook.items()]
[s.strip() for s in [’ hello ‘, ‘ in ‘, ‘ there ‘]]
Department of Computer Science - University of San Francisco - p.1/??…
Get the file Download here
Related Books:Related Searches: artificial intelligence programming, computer science university, usfca edu, list comprehension, chris brooks
Comments
Leave a Reply