Python Flashcards

1
Q

How to correctly represent commenting this line of code?

print(“Codecademy”)

A

print(“Codecademy”)

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

Based on the following code, what will be printed to the terminal?

platform = ‘Codecademy’
rating = ‘great!’

print(platform + ‘is’ + rating)

rating = ‘good.’

A

Codecademyisgreat!

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

What is the value of money_in_piggy_bank?

money_in_piggy_bank = 0
money_in_piggy_bank += 50
money_in_piggy_bank -= 25
money_in_piggy_bank += 100

print(“I have $” + str(money_in_piggy_bank) + “ in my piggy bank!”)

A

125

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

Which statement will be printed from this Python code?

print(5/2)

A

2.5

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

What is the output of the following code?

cool_number = 12 + 30
cool_number * 5
print(cool_number)

A

42

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