Knowledge Hub

Python Basics

TryHackMe11 answered prompts

Python Basics TryHackMe walkthrough with 11 answered prompts.

Prompts and answers

  • On the code editor, print "Hello World". What is the flag?
    THM{PRINT_STATEMENTS}
  • In the code editor, print the result of 21 + 43. What is the flag?
    THM{ADDITI0N}
  • Print the result of 142 - 52. What is the flag?
    THM{SUBTRCT}
  • Print the result of 10 * 342. What is the flag?
    THM{MULTIPLICATION_PYTHON}
  • Print the result of 5 squared. What is the flag?
    THM{EXP0N3NT_POWER}
  • On another new line, print out the value of height. What is the flag that appears?
    THM{VARIABL3S}
  • 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.
    THM{IF_STATEMENT_SHOPPING}
  • 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.
    THM{MY_FIRST_APP}
  • On the code editor, click back on the "script.py" tab and code a loop that outputs every number from 0 to 50.
    THM{L00PS_WHILE_FOR}
  • 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).
    THM{BITC0IN_INVESTOR}
  • In the code editor, write Python code to read the flag.txt file. What is the flag in this file?
    THM{F1LE_R3AD}