Working with Lists, Loop Flashcards

1
Q

Loop & Syntax

A

list=[‘one’,’two’,’three’]
for number in list:
print(number)

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

How to generate a series of numbers?

A

range()

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

How to make a List of Numbers?

A

numb=list(range(1,6))
print(numbers)

[1,2,3,4,5]

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

How to find the min, max and sum of a List of numbers?

A

min/max/sum (list_name)

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

How to Slice a List?

first 3

A

print(list_name[0:3])

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

How to start slicing at the begining of the List?

A

print(list_n [ :5])

print(list_n [5] : )) - from the 6th last number

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