Python Flashcards

1
Q

How do you print out “Hello!”?

A

> > > print(‘Hello!’)

Hello!

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

> > > “2” + “1”

What the output?

A

21

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

> > > print(“spam” * 3)

what the output?

A

spamspamspam

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

> > > int(“2”) + int(“1”)

What the output?

A

3

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

What is short for else if?

A

elif

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

nums = [5, 9, 15, 12, 8, 20]
print(len(nums))
what would the system print?

A

6

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

numbers = list(range(39, 50, 2))
print(numbers)
What numbers would print?

A

> > > [39, 41, 43, 45, 47, 49]

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

for i in range(6):
print(“Your Welcome!”)
What would be the outcome?

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

A method use to add an item to the end of a existing line?

A

apprend

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

A method use to add an item to any position of an existing line?

A

insert

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