To complete this puzzle, we first need to investigate the following lines of code:
a = "chips" b = "fish" print(a + " and " + b)
What would be the output of this code if you executed it?
Your challenge:
Complete lines 3,4 and 5, so that line 6 outputs “fish and chips”. You must comply with the following rules:
- You are only allowed to use 4 keys on your keyboard: a, b, c and =. You can use these keys as many times as necessary.
- You are not allowed to change lines 1,2 or 6.
Python Code
Trace Table
A trace table can be used to follow the steps of this algorithm one line of code at a time. This will help evaluate the impact of each steps on the different variables used in the code and on the predicted output of the program.
Complete the trace table below using your amended code to see if it produces the required output!
Line Number | a | b | c | OUTPUT | |
---|---|---|---|---|---|
1 | “Chips” | ||||
2 | “Fish” | ||||
3 | |||||
4 | |||||
5 | |||||
6 |
Solution...
The solution for this challenge is available to full members!Find out how to become a member:
➤ Members' Area