47 Common list patterns Flashcards

how to use both .list and .join

1
Q

wha happens if you use a list in this manner-> print(list(range(1,100)))?

A

you print out # 1 to 100

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q
  • how does .join function?
A

it joins what ou have before it to the list you beside it

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

what is an example of .join?

A

new_sentence = ‘ ‘.join([‘I’, ‘like’, ‘pizza’])
prints:
I like pizza

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