Variables, Strings, and Lists Flashcards

1
Q

What can variables not be?

A

Digits, special characters

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Assignment is not ____?

A

Symetric

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

String

A

Series of characters

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What characters mark strings?

A

Quotes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

If you have apostrophes and quote marks, and the syntax is important, what do you do?

A

Use slash marks

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

How do you separate strings?

A

Commas

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

How do you make words appear bigger?

A

title()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Float

A

Anything with a decimal

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

How do you make something a float?

A

Add a decimal

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

How do you remove whitespace?

A

Associate rstrip() with the variable name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How do you represent exponents?

A

**

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

List

A

Collection of items in a particular order

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What three things can lists include?

A

Letters of the alphabet, digit, or names

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

How is an empty list displayed?

A

[]

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How do you assign a new value to a specific element?

A

[list name element #) = ‘new name’

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

How do you add a new element to a list?

A

[list name.append (‘new element’)

17
Q

How do you insert elements to a specific position?

A

[list name.insert (index#, value)

18
Q

How do you delete an element?

A

del (list name) [index#, value]

19
Q

How do you remove an element if you don’t know its position?

A

listname.remove (‘value’)

20
Q

How do you find the length of a list?

A

len (list name)

21
Q

When do you use []

A

For lists