Python

¡Supera tus tareas y exámenes ahora con Quizwiz!

Strings

A sequence of characters, using the syntax of either single quotes or double quotes

Tuples

Ordered sequence of objects (immutable). Once an element is inside of a tuple, it can not be re-assigned. Use parenthesis

Lists

Ordered sequences that can hold a variety of object types (mutable). They support indexing and slicing and can be nested, and have a variety of useful methods that can be called off of them. Use square brackets.

Are strings mutable?

Strings are not mutable! Strings are immutable. (meaning you can't use indexing to change individual elements of a string)

Dictionaries

Unordered mappings for storing objects. As opposed to lists which store objects in an ordered sequence, dictionaries use key value pairing instead. Use curly braces.

How do I create comments in my code?

You can use the hashtag # to create comments in your code

. How do I index a nested list? For example if I want to grab 2 from [1,1,[1,2]]?

You would just add another set of brackets for indexing the nested list, for example: my_list[2][1] .

Numbers

store a numerical value can be an integer (whole number) or floating point (a decimal number)


Conjuntos de estudio relacionados

cosa 30 domain 6.0 research fluency

View Set

ACCT 284 LS: Stockholder's Equity

View Set

Comm 219 Midterm #1 Chapters 1, 2, 3, 7, 8, 10, & 12

View Set

TestOut Server Pro 2016: Networking Labs

View Set

Chapter 11: Joints of the Skull (pelswick48)

View Set

7.01 What Do You Know About "The Atomic Models"? & 7.02 Models of the Atom & 7.03 Atomic Theory & 7.04 Atoms and Molecules

View Set

Chapter 18: Regulation of Gene Expression

View Set