Python Flashcards
1
Q
How to correctly represent commenting this line of code?
print(“Codecademy”)
A
print(“Codecademy”)
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!
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
4
Q
Which statement will be printed from this Python code?
print(5/2)
A
2.5
5
Q
What is the output of the following code?
cool_number = 12 + 30
cool_number * 5
print(cool_number)
A
42
6
Q
A