πPython Basics
Using a web-based code editor, learn the basics of Python and put your knowledge into practice by eventually coding a short Bitcoin investment project.
Room Attributes
Value
Task 1 - Introduction to Python
Run what's currently in the code editor by clicking the green "Run Code" button (on the right-hand side of your screen), and move onto the next task.
Task 2 - Hello World
On the code editor, print "Hello World". What is the flag?
Task 3 - Mathematical Operators
In the code editor, print the result of 21 + 43. What is the flag?
Print the result of 142 - 52. What is the flag?
Print the result of 10 * 342. What is the flag?
Print the result of 5 squared. What is the flag?
Task 4 - Variables and Data Types
In the code editor, create a variable called height and set its initial value to 200.
On a new line, add 50 to the height variable.
On another new line, print out the value of height. What is the flag that appears?
Task 5 - Logical and Boolean Operators
Read the above section.
Task 6 - Shipping Project Introduction to If Statements
In this exercise, we will code a small application that calculates and outputs the shipping cost for a customer based on how much they've spent. In the code editor, click on the "shipping.py" tab and follow the instructions to complete this task.
shipping.py" tab and follow the instructions to complete this task.Once you've written the application in the code editor's shipping.py tab, a flag will appear, which is the answer to this question.
shipping.py tab, a flag will appear, which is the answer to this question.In shipping.py, on line 12 (when using the Code Editor's Hint), change the customer_basket_cost variable to 101 and re-run your code. You will get a flag (if the total cost is correct based on your code); the flag is the answer to this question.
shipping.py, on line 12 (when using the Code Editor's Hint), change the customer_basket_cost variable to 101 and re-run your code. You will get a flag (if the total cost is correct based on your code); the flag is the answer to this question.Task 7 - Loops
On the code editor, click back on the "script.py" tab and code a loop that outputs every number from 0 to 50.
script.py" tab and code a loop that outputs every number from 0 to 50.Task 8 - Bitcoin Project Introduction to Functions
Once you've written the bitcoinToUSD function, use it to calculate the value of your Bitcoin in USD, and then create an if statement to determine if the value falls below $30,000; if it does, output a message to alert you (via a print statement).
1 Bitcoin is now worth $25,000. In the code editor on line 14, update the bitcoin_to_usd variable value to 25000 and see if your Python program recognises that your investment is below the $30,000 threshold.
bitcoin_to_usd variable value to 25000 and see if your Python program recognises that your investment is below the $30,000 threshold.Task 9 - Files
In the code editor, write Python code to read the flag.txt file. What is the flag in this file?
Task 10 - Imports
Read the task and run the Python example code above in the code editor on the right.
Last updated
