Module 3 challenge: Automatically Generate a PDF and Send it by Email :Automating Real-World Tasks with Python (Google IT Automation with Python Professional Certificate) Answers 2025
1. Overall purpose of reports.py
❌ To create a PDF of the report
❌ To print a report
✔️ To format a report
❌ To send a report
2. Step before running example.py
❌ ./scripts/example.py
❌ cat ~/scripts/example.py
✔️ sudo chmod o+wx ~/scripts/example.py
❌ ls ~/scripts
3. Fix “Permission denied” when running example.py
✔️ Use the sudo chmod command to enable execution
❌ Use nano to edit
❌ Run in debug mode
❌ Use cat to view
4. cars.py not writable
❌ Haven’t loaded SSH key
✔️ Must change permissions on cars.py
❌ Must run cars.py to edit
❌ Must make a copy first
5. Source of data in cars.py
❌ Pulls from format_car method
✔️ Pulls from car_sales.json file
❌ Uses process_data to generate data
❌ Creates data when script runs
6. Line required for emails.send in example.py
✔️ import emails
❌ emails.generate
❌ import reports
❌ reports.generate
7. Purpose of import os in example.py
❌ To generate an email
❌ To generate table_data content
✔️ To retrieve a file from the file system
❌ To generate a report
8. Purpose of import reportlab and SimpleDocTemplate in reports.py
✔️ Specify the format of the PDF
✔️ Import the reportlab library
❌ Specify the email message format
✔️ Create the PDF
9. Purpose of if item_revenue > max_revenue["revenue"] in cars.py
✔️ Identify which car generated the highest sales
❌ Find the lowest sales
❌ Determine table inclusion
❌ Exit function
10. Commands required to send an email
❌ reports.generate
✔️ emails.generate
✔️ import emails
✔️ emails.send
📌 Summary Table
| Q# | Correct Answer(s) |
|---|---|
| 1 | Format a report ✔️ |
| 2 | sudo chmod o+wx ✔️ |
| 3 | Use chmod to execute ✔️ |
| 4 | Change permissions ✔️ |
| 5 | Pull from car_sales.json ✔️ |
| 6 | import emails ✔️ |
| 7 | Retrieve file from filesystem ✔️ |
| 8 | Specify PDF format, import reportlab, create PDF ✔️ |
| 9 | Identify highest revenue car ✔️ |
| 10 | emails.generate, import emails, emails.send ✔️ |