Python: Core Concepts
Build a foundational knowledge of Python core concepts.
Task 1: INTRODUCTION
1.1 Let’s master Python’s core concepts!
Ans- No answer needed
Task 2: Quick Review: Hello World, Variables, and Conditionals
2.1 What built-in function reveals the data type of a value?
Ans- type()
2.2 If a user types 3.14 at an input() prompt, what data type does Python store it as before any conversion?
Ans- str
2.3 On the attached VM, open and run fstrings_demo.py. What is the last line printed to the terminal?
Ans- Scan complete: 192.168.1.1 has 3 open ports
Task 3 :Working with Strings
3.1 What function returns the number of characters in a string?
Ans- len()
3.2 Given word = "TryHackMe", what does word[3:7] return?
Ans- Hack
3.3 What string method converts "ADMIN" to "admin"?
Ans- .lower
Task 4 :Lists and Dictionaries
Get Sangzzz’s stories in your inbox
Join Medium for free to get updates from this writer.
4.1 What method adds an element to the end of a list?
Ans- .append()
4.2 Given services = {22: "SSH", 80: "HTTP"}, what does services[80] return?
Ans- HTTP
4.3 What dictionary method lets you retrieve a value with a safe fallback if the key does not exist?
Ans- .get()
Task 5 :Arithmetic and Membership Operators
5.1 What operator returns the remainder of a division?
Ans- %
5.2 What does 10 // 3 evaluate to?
Ans- 3
5.3 What does 2 ** 10 evaluate to?
Ans- 1024
Task 6 :Loops: for and while
6.1 What type of loop is best suited for iterating over each item in a list?
Ans- for
6.2 What does range(3) produce?
Ans- 0,1,2
6.3 What keyword immediately exits a loop?
Ans- break
Task 7 :Conclusion
7.1 I have successfully completed the room!
Ans- No answer needed
Happy learnig!







