Samantha doesn't care about the name of her variables after she has defined them. This often results in duplicate names in her Python code, and since Python is case sensitive, this can cause some trouble.
What is the output of the code below?
1 2 3 4 5 6 |
|
Graham has written a "dump" function in Python to sell all the shares of his tech stocks in case of bad news in the market. However, he hasn't tested his code, and he's made an important mistake:
1 2 3 |
|
Why will this code fail?
Tony wants to print out the full lyrics to the song "99 Bottles of Beer on the Wall," so he's written the code below. The song is supposed to involve taking down each of the 99 bottles in turn and passing them around until all the bottles have been taken down and passed around.
1 2 3 4 5 6 7 8 9 |
|
Xavier works at a sporting goods shop in the online sales department, and he is debugging the code below, which is designed to call the purchase_item()
function several times, until all desired items have been bagged. The purchase_item()
function will purchase exactly 1 item each time it is called, but will not make any changes to variables in the program.
What is wrong with the code?
1 2 3 4 5 |
|
John can't get his code to work correctly. He's trying to calculate the Fibonacci sequence, but his code isn't working. What is he doing wrong?
1 2 3 4 5 6 7 8 9 |
|