CS 1110 Study Guide - Final Guide: Newline

70 views5 pages

Document Summary

In general, there are always 2 scopes at any given time: global scope (anything outside a function and anything w/ global, local scope (anything inside a function w/out global) Includes parameters and local variables: can"t see local scopes of other functions x = 3 def f(x); >> this x is local global y x = 2 >> this x is local too y = 3 f(x) Lists: ordered items (any), by consecutive indices from 0, want if you have a bunch of things, without care for keys. Dicts: not odered, {key:value} pairs, keys are unique, key = computing id, value = everything i know you, this can allow you to look items up by something. In lists, we can only look things up by position d d[key] = value keys() >> returns list of keys values() >> returns list of values items() >> tuple of lists. group() >> returns string if found, returns whole group if no (parentheses)

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers

Related Documents