Update page 'Day 9 homework - Sloetjes'

xuanyi.wang
2023-04-19 04:48:17 +02:00
parent 5f64ae9a4c
commit 436ecf2c28
+9
@@ -46,5 +46,14 @@ print(get_all_modules_size())
**3. Run your Python interpreter like you would normally, using Jupyter, and run the last function. How many bytes are being used?** **3. Run your Python interpreter like you would normally, using Jupyter, and run the last function. How many bytes are being used?**
![Q3](https://gogs.gtsplab.com:5432/j/python-bootcamp/raw/Branch_Sloetjes/Q3.png) ![Q3](https://gogs.gtsplab.com:5432/j/python-bootcamp/raw/Branch_Sloetjes/Q3.png)
**4. Now, run the same function, but start the Python interpreter in Powershell (Windows), or the regular shell (MacOS/Linux) with the `-E` flag, which ignores environment variables and should only load the modules that came with the original build of the Python interpreter. How many bytes are being used now?** **4. Now, run the same function, but start the Python interpreter in Powershell (Windows), or the regular shell (MacOS/Linux) with the `-E` flag, which ignores environment variables and should only load the modules that came with the original build of the Python interpreter. How many bytes are being used now?**
![Q4](https://gogs.gtsplab.com:5432/j/python-bootcamp/raw/Branch_Sloetjes/Q4.png) ![Q4](https://gogs.gtsplab.com:5432/j/python-bootcamp/raw/Branch_Sloetjes/Q4.png)
**5. With only the `sys` module loaded, look at the `sys.modules` dict. What is the type of the value of the `os` key?**
##### Answer:
The type of the value of the `os` key in the sys.modules dictionary depends on whether the os module has been loaded yet.
If the `os` module has not been loaded yet, the value of the `os` key will be `NoneType`.
If the os module has been loaded, the value of the os key will be a module object representing the `os` module.