Module 3 challenge: Fixing errors in Python scripts :Troubleshooting and Debugging Techniques (Google IT Automation with Python Professional Certificate) Answers 2025
1. Use pip3 to address ImportError
✔️ Install the missing module using pip3
❌ Update the Python interpreter
❌ Reinstall the Python script
❌ Execute the script with Python 2
2. Address ImportError in /usr/bin script
✔️ Install the missing module using pip3
❌ Modify the script’s code to bypass the missing module
❌ Delete the script and recreate it
❌ Reinstall the Python interpreter
3. Benefit of matplotlib library
❌ Provides a Python code editor
❌ Simplifies concurrent execution
✔️ Offers a wide range of data visualization tools
❌ Enables creation of web applications
4. Role of chmod 777
✔️ Changed file permissions to make the data.csv file writable
❌ Modified script code
❌ Installed Python library
❌ Uninstalled matplotlib
5. Most effective way to debug a recurring problem
❌ Upgrade system software
✔️ Identify the sequence of events leading to the problem
❌ Restart the system
❌ Increase system memory
6. Things to check when debugging later iterations (select all that apply)
✔️ Future software upgrades
✔️ Current bug reports
❌ Redesigns of the user interface
❌ More users
7. Why effective debugging is essential
✔️ Helps identify and rectify errors, improving functionality and reliability
❌ Helps understand Python syntax
❌ Ensures scripts run without any issues
❌ Allows showcasing coding skills
8. Step after reproducing a bug
✔️ Review the code to understand what it’s supposed to do
❌ Ask a colleague
❌ Rewrite the code
❌ Run the program again
9. Next step after fixing code
❌ Immediately share the code
❌ Reinstall Python
✔️ Test the script thoroughly
❌ Delete the script
10. Causes of NoFileError (select all that apply)
❌ Moving data.csv to the working folder
✔️ Renaming data.bak to data.csv
✔️ Checking the working folder for data.csv
❌ Changing permissions on data.csv
📌 Summary Table
| Q# | Correct Answer(s) |
|---|---|
| 1 | Install missing module ✔️ |
| 2 | Install missing module ✔️ |
| 3 | Data visualization tools ✔️ |
| 4 | chmod 777 to make data.csv writable ✔️ |
| 5 | Identify sequence of events ✔️ |
| 6 | Future upgrades ✔️, Current bug reports ✔️ |
| 7 | Debugging improves functionality & reliability ✔️ |
| 8 | Review code ✔️ |
| 9 | Test script thoroughly ✔️ |
| 10 | Rename data.bak ✔️, Check working folder ✔️ |