├── .DS_Store
├── .gitignore
├── Crash Course on Python
├── CrashCourseonPython.pdf
├── WEEK 1
│ ├── Graded Assisment-1
│ │ ├── grade7.png
│ │ ├── graded-1.png
│ │ ├── graded2.png
│ │ ├── graded3.png
│ │ ├── graded4.png
│ │ ├── graded5.png
│ │ ├── graded6.png
│ │ └── solutions
│ ├── practice quiz 1
│ │ ├── pquiz1-1.jpeg
│ │ ├── pquiz1-2.png
│ │ ├── pquiz1-3.png
│ │ ├── pquiz1-4.png
│ │ ├── pquiz1-5.png
│ │ └── solutions
│ ├── practice quiz 2
│ │ ├── pquiz2-1.png
│ │ ├── pquiz2-2.png
│ │ ├── pquiz2-3.png
│ │ ├── pquiz2-4.png
│ │ └── soltuions.py
│ └── practice quiz 3
│ │ ├── Pquiz3-1.jpeg
│ │ ├── Pquiz3-2.jpeg
│ │ ├── Pquiz3-3.jpeg
│ │ └── solutions
├── WEEK 2
│ ├── Graded Assessment
│ │ ├── gquiz1.png
│ │ ├── gquiz10.png
│ │ ├── gquiz2.png
│ │ ├── gquiz3.png
│ │ ├── gquiz4.png
│ │ ├── gquiz5.png
│ │ ├── gquiz6.png
│ │ ├── gquiz7.png
│ │ ├── gquiz8.png
│ │ ├── gquiz9.png
│ │ └── solutions.py
│ ├── practice quiz 1
│ │ ├── pquiz1-1.png
│ │ ├── pquiz1-2.png
│ │ ├── pquiz1-3.png
│ │ └── solutions
│ ├── practice quiz 2
│ │ ├── q2-1.png
│ │ ├── q2-2.png
│ │ ├── q2-3.png
│ │ ├── q2-4.png
│ │ ├── q2-5.png
│ │ └── solutions.py
│ └── practice quiz 3
│ │ ├── q3-1.png
│ │ ├── q3-2.png
│ │ ├── q3-3.png
│ │ ├── q3-4.png
│ │ ├── q3-5.png
│ │ └── solutions.py
├── WEEK 4
│ ├── Graded Assessment
│ │ ├── gquiz41.png
│ │ ├── gquiz410.png
│ │ ├── gquiz42.png
│ │ ├── gquiz43.png
│ │ ├── gquiz44.png
│ │ ├── gquiz45.png
│ │ ├── gquiz46.png
│ │ ├── gquiz47.png
│ │ ├── gquiz48.png
│ │ ├── gquiz49.png
│ │ └── solutions.py
│ ├── practice quiz 1
│ │ ├── pquiz1-1.png
│ │ ├── pquiz1-2.png
│ │ ├── pquiz1-3.png
│ │ ├── pquiz1-4.png
│ │ ├── pquiz1-5.png
│ │ └── solutions.py
│ ├── practice quiz 2
│ │ ├── pquiz2-1.png
│ │ ├── pquiz2-2.png
│ │ ├── pquiz2-3.png
│ │ ├── pquiz2-4.png
│ │ ├── pquiz2-5.png
│ │ ├── pquiz2-6.png
│ │ └── solutions.py
│ ├── practice quiz 3
│ │ ├── pquiz31.png
│ │ ├── pquiz32.png
│ │ ├── pquiz33.png
│ │ ├── pquiz34.png
│ │ ├── pquiz35.png
│ │ └── solution.py
│ └── video questions
│ │ ├── Dictionaries vs Lists.py
│ │ ├── Formatting Strings.py
│ │ ├── Iterating over the Contents of a Dictionary.py
│ │ ├── List Comprehensions.py
│ │ ├── Lists and Tuples.py
│ │ ├── Modifying the Contents of a List.py
│ │ ├── Video Question More String Method.py
│ │ ├── What is Dictionary.py
│ │ ├── What is a list.py
│ │ └── files
├── WEEK 5
│ ├── Assessment - Object-oriented programming
│ │ ├── solutions.ipynb
│ │ ├── utf-8''C1M5_Object_Oriented_Programming_V7.ipynb
│ │ └── utf-8''C1M5_Object_Oriented_Programming_V7.pdf
│ ├── Code Reuse
│ │ ├── Solution.ipynb
│ │ ├── utf-8''C1M5L3_Code_Reuse_V2.ipynb
│ │ └── utf-8''C1M5L3_Code_Reuse_V2.pdf
│ ├── Methods and Classes
│ │ └── utf-8''C1M5L2_Methods_and_Classes_V3.ipynb
│ ├── pquiz11.png
│ ├── pquiz12.png
│ ├── pquiz13.png
│ ├── pquiz14.png
│ ├── pquiz15.png
│ ├── solutions.py
│ └── utf-8''C1M5L2_Methods_and_Classes_V3.pdf
├── WEEK 6
│ ├── Final Project - Word Cloud
│ │ ├── Meflux.txt
│ │ ├── meflux.png
│ │ ├── utf-8''C1M6L2_Final_Project_V3.ipynb
│ │ └── utf-8''C1M6L2_Final_Project_V3.pdf
│ └── Practice Notebook - Putting It All Together
│ │ ├── solution.ipynb
│ │ ├── utf-8''C1M6L1_Putting_It_All_Together.ipynb
│ │ └── utf-8''C1M6L1_Putting_It_All_Together.pdf
└── WEEK3
│ ├── Graded Assessment
│ ├── gquiz1.png
│ ├── gquiz2.png
│ ├── gquiz3.png
│ ├── gquiz4.png
│ ├── gquiz5.png
│ ├── gquiz6.png
│ ├── gquiz7.png
│ ├── gquiz8.png
│ ├── gquiz9.png
│ └── solutions.py
│ ├── practice quiz 1
│ ├── pquiz1-1.png
│ ├── pquiz1-2.png
│ ├── pquiz1-3.png
│ ├── pquiz1-4.png
│ ├── pquiz1-5.png
│ └── solution.py
│ ├── practice quiz 2
│ ├── pquiz2-1.png
│ ├── pquiz2-2.png
│ ├── pquiz2-3.png
│ └── solutions.py
│ └── practice quiz 3
│ ├── pquiz3-1.png
│ ├── pquiz3-2.png
│ ├── pquiz3-3.png
│ ├── pquiz3-4.png
│ ├── pquiz3-5.png
│ └── solutions.py
├── LICENSE
├── README.md
└── Using Python to Interact with the Operating System
├── WEEK 1
├── Graded Assesment
│ └── scripts
│ │ ├── Screenshot (30).png
│ │ ├── Screenshot (31).png
│ │ ├── Screenshot (32).png
│ │ ├── health_checks.py
│ │ ├── network.py
│ │ └── readme.md
├── Practice Quiz_ Automation
│ ├── Screenshot (25).png
│ ├── Screenshot (26).png
│ ├── Screenshot (27).png
│ ├── Screenshot (28).png
│ ├── Screenshot (29).png
│ └── Solution.py
├── Practice Quiz_ Getting Ready for Python
│ ├── Screenshot (14).png
│ ├── Screenshot (15).png
│ ├── Screenshot (16).png
│ ├── Screenshot (17).png
│ └── Solution.py
└── Practice Quiz_ Running Python Locally
│ ├── Screenshot (14).png
│ ├── Screenshot (15).png
│ ├── Screenshot (16).png
│ ├── Screenshot (17).png
│ ├── Screenshot (18).png
│ └── Solution.py
├── WEEK 2
├── Practice Notebook: Text Files
│ ├── Solution.py
│ ├── utf-8''C2M2L1_Reading_And_Writing_Files.ipynb
│ └── utf-8''C2M2L1_Reading_And_Writing_Files.pdf
├── Practice Quiz: Managing Files & Directories
│ ├── Screenshot (33).png
│ ├── Screenshot (34).png
│ ├── Screenshot (35).png
│ ├── Screenshot (36).png
│ ├── Screenshot (37).png
│ └── solutions.py
├── Practice Quiz: Reading & Writing CSV Files
│ ├── Screenshot (38).png
│ ├── Screenshot (39).png
│ ├── Screenshot (40).png
│ ├── Screenshot (41).png
│ ├── Screenshot (42).png
│ ├── Screenshot (43).png
│ ├── Screenshot (45).png
│ └── solution.py
└── Qwiklabs Assessment: Handling Files
│ ├── Data
│ ├── Report.txt
│ └── employees.csv
│ ├── Scripts
│ └── generate_report.py
│ └── readme.md
└── WEEK 3
└── Practice Quiz
├── Basic Regular Expressions
├── Screenshot (49).png
├── Screenshot (50).png
├── Screenshot (51).png
├── Screenshot (52).png
├── Screenshot (53).png
└── Solution.py
├── Reguar Expressions
├── Screenshot (46).png
├── Screenshot (47).png
├── Screenshot (48).png
└── only check the photos.txt
└── Solutions.py
/.DS_Store:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/.DS_Store
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Byte-compiled / optimized / DLL files
2 | __pycache__/
3 | *.py[cod]
4 | *$py.class
5 |
6 | # C extensions
7 | *.so
8 |
9 | # Distribution / packaging
10 | .Python
11 | build/
12 | develop-eggs/
13 | dist/
14 | downloads/
15 | eggs/
16 | .eggs/
17 | lib/
18 | lib64/
19 | parts/
20 | sdist/
21 | var/
22 | wheels/
23 | pip-wheel-metadata/
24 | share/python-wheels/
25 | *.egg-info/
26 | .installed.cfg
27 | *.egg
28 | MANIFEST
29 |
30 | # PyInstaller
31 | # Usually these files are written by a python script from a template
32 | # before PyInstaller builds the exe, so as to inject date/other infos into it.
33 | *.manifest
34 | *.spec
35 |
36 | # Installer logs
37 | pip-log.txt
38 | pip-delete-this-directory.txt
39 |
40 | # Unit test / coverage reports
41 | htmlcov/
42 | .tox/
43 | .nox/
44 | .coverage
45 | .coverage.*
46 | .cache
47 | nosetests.xml
48 | coverage.xml
49 | *.cover
50 | *.py,cover
51 | .hypothesis/
52 | .pytest_cache/
53 |
54 | # Translations
55 | *.mo
56 | *.pot
57 |
58 | # Django stuff:
59 | *.log
60 | local_settings.py
61 | db.sqlite3
62 | db.sqlite3-journal
63 |
64 | # Flask stuff:
65 | instance/
66 | .webassets-cache
67 |
68 | # Scrapy stuff:
69 | .scrapy
70 |
71 | # Sphinx documentation
72 | docs/_build/
73 |
74 | # PyBuilder
75 | target/
76 |
77 | # Jupyter Notebook
78 | .ipynb_checkpoints
79 |
80 | # IPython
81 | profile_default/
82 | ipython_config.py
83 |
84 | # pyenv
85 | .python-version
86 |
87 | # pipenv
88 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89 | # However, in case of collaboration, if having platform-specific dependencies or dependencies
90 | # having no cross-platform support, pipenv may install dependencies that don't work, or not
91 | # install all needed dependencies.
92 | #Pipfile.lock
93 |
94 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow
95 | __pypackages__/
96 |
97 | # Celery stuff
98 | celerybeat-schedule
99 | celerybeat.pid
100 |
101 | # SageMath parsed files
102 | *.sage.py
103 |
104 | # Environments
105 | .env
106 | .venv
107 | env/
108 | venv/
109 | ENV/
110 | env.bak/
111 | venv.bak/
112 |
113 | # Spyder project settings
114 | .spyderproject
115 | .spyproject
116 |
117 | # Rope project settings
118 | .ropeproject
119 |
120 | # mkdocs documentation
121 | /site
122 |
123 | # mypy
124 | .mypy_cache/
125 | .dmypy.json
126 | dmypy.json
127 |
128 | # Pyre type checker
129 | .pyre/
130 |
--------------------------------------------------------------------------------
/Crash Course on Python/CrashCourseonPython.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/CrashCourseonPython.pdf
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 1/Graded Assisment-1/grade7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 1/Graded Assisment-1/grade7.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 1/Graded Assisment-1/graded-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 1/Graded Assisment-1/graded-1.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 1/Graded Assisment-1/graded2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 1/Graded Assisment-1/graded2.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 1/Graded Assisment-1/graded3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 1/Graded Assisment-1/graded3.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 1/Graded Assisment-1/graded4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 1/Graded Assisment-1/graded4.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 1/Graded Assisment-1/graded5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 1/Graded Assisment-1/graded5.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 1/Graded Assisment-1/graded6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 1/Graded Assisment-1/graded6.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 1/Graded Assisment-1/solutions:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 1/practice quiz 1/pquiz1-1.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 1/practice quiz 1/pquiz1-1.jpeg
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 1/practice quiz 1/pquiz1-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 1/practice quiz 1/pquiz1-2.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 1/practice quiz 1/pquiz1-3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 1/practice quiz 1/pquiz1-3.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 1/practice quiz 1/pquiz1-4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 1/practice quiz 1/pquiz1-4.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 1/practice quiz 1/pquiz1-5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 1/practice quiz 1/pquiz1-5.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 1/practice quiz 1/solutions:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 1/practice quiz 2/pquiz2-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 1/practice quiz 2/pquiz2-1.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 1/practice quiz 2/pquiz2-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 1/practice quiz 2/pquiz2-2.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 1/practice quiz 2/pquiz2-3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 1/practice quiz 2/pquiz2-3.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 1/practice quiz 2/pquiz2-4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 1/practice quiz 2/pquiz2-4.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 1/practice quiz 2/soltuions.py:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 1/practice quiz 3/Pquiz3-1.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 1/practice quiz 3/Pquiz3-1.jpeg
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 1/practice quiz 3/Pquiz3-2.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 1/practice quiz 3/Pquiz3-2.jpeg
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 1/practice quiz 3/Pquiz3-3.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 1/practice quiz 3/Pquiz3-3.jpeg
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 1/practice quiz 3/solutions:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 2/Graded Assessment/gquiz1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 2/Graded Assessment/gquiz1.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 2/Graded Assessment/gquiz10.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 2/Graded Assessment/gquiz10.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 2/Graded Assessment/gquiz2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 2/Graded Assessment/gquiz2.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 2/Graded Assessment/gquiz3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 2/Graded Assessment/gquiz3.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 2/Graded Assessment/gquiz4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 2/Graded Assessment/gquiz4.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 2/Graded Assessment/gquiz5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 2/Graded Assessment/gquiz5.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 2/Graded Assessment/gquiz6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 2/Graded Assessment/gquiz6.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 2/Graded Assessment/gquiz7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 2/Graded Assessment/gquiz7.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 2/Graded Assessment/gquiz8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 2/Graded Assessment/gquiz8.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 2/Graded Assessment/gquiz9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 2/Graded Assessment/gquiz9.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 2/Graded Assessment/solutions.py:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 2/practice quiz 1/pquiz1-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 2/practice quiz 1/pquiz1-1.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 2/practice quiz 1/pquiz1-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 2/practice quiz 1/pquiz1-2.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 2/practice quiz 1/pquiz1-3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 2/practice quiz 1/pquiz1-3.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 2/practice quiz 1/solutions:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 2/practice quiz 2/q2-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 2/practice quiz 2/q2-1.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 2/practice quiz 2/q2-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 2/practice quiz 2/q2-2.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 2/practice quiz 2/q2-3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 2/practice quiz 2/q2-3.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 2/practice quiz 2/q2-4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 2/practice quiz 2/q2-4.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 2/practice quiz 2/q2-5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 2/practice quiz 2/q2-5.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 2/practice quiz 2/solutions.py:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 2/practice quiz 3/q3-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 2/practice quiz 3/q3-1.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 2/practice quiz 3/q3-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 2/practice quiz 3/q3-2.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 2/practice quiz 3/q3-3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 2/practice quiz 3/q3-3.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 2/practice quiz 3/q3-4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 2/practice quiz 3/q3-4.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 2/practice quiz 3/q3-5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 2/practice quiz 3/q3-5.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 2/practice quiz 3/solutions.py:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 4/Graded Assessment/gquiz41.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 4/Graded Assessment/gquiz41.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 4/Graded Assessment/gquiz410.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 4/Graded Assessment/gquiz410.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 4/Graded Assessment/gquiz42.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 4/Graded Assessment/gquiz42.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 4/Graded Assessment/gquiz43.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 4/Graded Assessment/gquiz43.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 4/Graded Assessment/gquiz44.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 4/Graded Assessment/gquiz44.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 4/Graded Assessment/gquiz45.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 4/Graded Assessment/gquiz45.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 4/Graded Assessment/gquiz46.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 4/Graded Assessment/gquiz46.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 4/Graded Assessment/gquiz47.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 4/Graded Assessment/gquiz47.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 4/Graded Assessment/gquiz48.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 4/Graded Assessment/gquiz48.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 4/Graded Assessment/gquiz49.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 4/Graded Assessment/gquiz49.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 4/Graded Assessment/solutions.py:
--------------------------------------------------------------------------------
1 | #Q1:
2 | def format_address(address_string):
3 | # Declare variables
4 |
5 | # Separate the address string into parts
6 | list1=address_string.split(" ")
7 |
8 | # Traverse through the address parts
9 | st=""
10 | for x in range (len(list1)):
11 | if(x!=0):
12 | st+=list1[x]+" "
13 | # Determine if the address part is the
14 | # house number or part of the street name
15 |
16 | # Does anything else need to be done
17 | # before returning the result?
18 |
19 | # Return the formatted string
20 | return "house number {} on street named {}".format(list1[0],st.strip())
21 |
22 | print(format_address("123 Main Street"))
23 | # Should print: "house number 123 on street named Main Street"
24 |
25 | print(format_address("1001 1st Ave"))
26 | # Should print: "house number 1001 on street named 1st Ave"
27 |
28 | print(format_address("55 North Center Drive"))
29 | # Should print "house number 55 on street named North Center Drive"
30 |
31 |
32 | #Q2:
33 | import re
34 | def highlight_word(sentence, word):
35 | return sentence.replace(word,word.upper())
36 |
37 | print(highlight_word("Have a nice day", "nice"))
38 | print(highlight_word("Shhh, don't be so loud!", "loud"))
39 | print(highlight_word("Automating with Python is fun", "fun"))
40 |
41 |
42 | #Q3
43 | def combine_lists(list1, list2):
44 | # Generate a new list containing the elements of list2
45 | # Followed by the elements of list1 in reverse order
46 | return list2+list1[::-1]
47 |
48 |
49 | Jamies_list = ["Alice", "Cindy", "Bobby", "Jan", "Peter"]
50 | Drews_list = ["Mike", "Carol", "Greg", "Marcia"]
51 |
52 | print(combine_lists(Jamies_list, Drews_list))
53 |
54 |
55 | #Q4:
56 | def squares(start, end):
57 | return [ x*x for x in range(start,end+1) ]
58 |
59 | print(squares(2, 3)) # Should be [4, 9]
60 | print(squares(1, 5)) # Should be [1, 4, 9, 16, 25]
61 | print(squares(0, 10)) # Should be [0, 1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
62 |
63 |
64 | #Q5:
65 | def car_listing(car_prices):
66 | result = ""
67 | for key,value in car_prices.items():
68 | result += ("{} costs {} dollars".format(key,value) + "\n")
69 | return result
70 |
71 | print(car_listing({"Kia Soul":19000, "Lamborghini Diablo":55000, "Ford Fiesta":13000, "Toyota Prius":24000}))
72 |
73 |
74 | #Q6:
75 | def combine_guests(guests1, guests2):
76 | # Combine both dictionaries into one, with each key listed
77 | # only once, and the value from guests1 taking precedence
78 | guests2.update(guests1)
79 | return guests2
80 |
81 | Rorys_guests = { "Adam":2, "Brenda":3, "David":1, "Jose":3, "Charlotte":2, "Terry":1, "Robert":4}
82 | Taylors_guests = { "David":4, "Nancy":1, "Robert":2, "Adam":1, "Samantha":3, "Chris":5}
83 |
84 | print(combine_guests(Rorys_guests, Taylors_guests))
85 |
86 |
87 | #Q7:
88 | def count_letters(text):
89 | result = {}
90 | text = text.lower()
91 | for letter in text:
92 | if letter.isalpha():
93 | if letter in result.keys():
94 | result[letter] += 1
95 | else:
96 | result[letter] = 1
97 | return result
98 | print(count_letters("AaBbCc"))
99 | # Should be {'a': 2, 'b': 2, 'c': 2}
100 |
101 | print(count_letters("Math is fun! 2+2=4"))
102 | # Should be {'m': 1, 'a': 1, 't': 1, 'h': 1, 'i': 1, 's': 1, 'f': 1, 'u': 1, 'n': 1}
103 |
104 | print(count_letters("This is a sentence."))
105 | # Should be {'t': 2, 'h': 1, 'i': 2, 's': 3, 'a': 1, 'e': 3, 'n': 2, 'c': 1}
106 |
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 4/practice quiz 1/pquiz1-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 4/practice quiz 1/pquiz1-1.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 4/practice quiz 1/pquiz1-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 4/practice quiz 1/pquiz1-2.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 4/practice quiz 1/pquiz1-3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 4/practice quiz 1/pquiz1-3.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 4/practice quiz 1/pquiz1-4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 4/practice quiz 1/pquiz1-4.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 4/practice quiz 1/pquiz1-5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 4/practice quiz 1/pquiz1-5.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 4/practice quiz 1/solutions.py:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 4/practice quiz 2/pquiz2-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 4/practice quiz 2/pquiz2-1.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 4/practice quiz 2/pquiz2-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 4/practice quiz 2/pquiz2-2.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 4/practice quiz 2/pquiz2-3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 4/practice quiz 2/pquiz2-3.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 4/practice quiz 2/pquiz2-4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 4/practice quiz 2/pquiz2-4.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 4/practice quiz 2/pquiz2-5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 4/practice quiz 2/pquiz2-5.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 4/practice quiz 2/pquiz2-6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 4/practice quiz 2/pquiz2-6.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 4/practice quiz 2/solutions.py:
--------------------------------------------------------------------------------
1 | #q1
2 | filenames = ["program.c", "stdio.hpp", "sample.hpp", "a.out", "math.hpp", "hpp.out"]
3 | # Generate newfilenames as a list containing the new filenames
4 | # using as many lines of code as your chosen method requires.
5 | newfilenames=[]
6 | for files in range (len(filenames)):
7 | if "hpp" in filenames[files][3:]:
8 | newfilenames.append(filenames[files][:-2])
9 | else:
10 | newfilenames.append(filenames[files])
11 | print(newfilenames)
12 | # Should be ["program.c", "stdio.h", "sample.h", "a.out", "math.h", "hpp.out"]
13 |
14 |
15 | #q2
16 | def pig_latin(text):
17 | say = ""
18 | # Separate the text into words
19 | words = text.split(" ")
20 | for word in words:
21 | # Create the pig latin word and add it to the list
22 | say+=word[1:]+word[0]+"ay "
23 | # Turn the list back into a phrase
24 | return say
25 |
26 | print(pig_latin("hello how are you")) # Should be "ellohay owhay reaay ouyay"
27 | print(pig_latin("programming in python is fun")) # Should be "rogrammingpay niay ythonpay siay unfay"
28 |
29 |
30 | #q3
31 | def octal_to_string(octal):
32 | result = ""
33 | value_letters = [(4,"r"),(2,"w"),(1,"x")]
34 | # Iterate over each of the digits in octal
35 | for m in [int(n) for n in str(octal)]:
36 | # Check for each of the permissions values
37 | for value, letter in value_letters:
38 | if m >= value:
39 | result += letter
40 | m-= value
41 | else:
42 | result+="-"
43 | return result
44 |
45 | print(octal_to_string(755)) # Should be rwxr-xr-x
46 | print(octal_to_string(644)) # Should be rw-r--r--
47 | print(octal_to_string(750)) # Should be rwxr-x---
48 | print(octal_to_string(600)) # Should be rw-------
49 |
50 | #q5
51 | def group_list(group, users):
52 | result = ""
53 | if len(group)!=0:
54 | result += group+":"
55 | if len(users)!=0:
56 | result += " "+users[0]
57 | if len(users)>1:
58 | for x in users[1:]:
59 | result += ", "+x
60 | return result
61 |
62 | # Testing
63 | print(group_list("Marketing", ["Mike", "Karen", "Jake", "Tasha"]))
64 | print(group_list("Engineering", ["Kim", "Jay", "Tom"]))
65 | print (group_list("Users",""))
66 |
67 | #q6
68 | def guest_list(guests):
69 | count = 0
70 | if count < 1:
71 | for guest in guests:
72 | name,age,job=guest
73 | print("{} is {} years old and works as {}".format(name,age,job))
74 | count =count +1
75 |
76 |
77 | guest_list([('Ken', 30, "Chef"), ("Pat", 35, 'Lawyer'), ('Amanda', 25, "Engineer")])
78 |
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 4/practice quiz 3/pquiz31.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 4/practice quiz 3/pquiz31.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 4/practice quiz 3/pquiz32.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 4/practice quiz 3/pquiz32.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 4/practice quiz 3/pquiz33.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 4/practice quiz 3/pquiz33.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 4/practice quiz 3/pquiz34.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 4/practice quiz 3/pquiz34.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 4/practice quiz 3/pquiz35.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 4/practice quiz 3/pquiz35.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 4/practice quiz 3/solution.py:
--------------------------------------------------------------------------------
1 | #Q1:
2 | def email_list(domains):
3 | emails = []
4 | for domain,users in domains.items():
5 | for user in users:
6 | emails.append(user+ "@" +domain)
7 | return(emails)
8 |
9 | print(email_list({"gmail.com": ["clark.kent", "diana.prince", "peter.parker"], "yahoo.com": ["barbara.gordon", "jean.grey"], "hotmail.com": ["bruce.wayne"]}))
10 |
11 |
12 | #Q2:
13 |
14 | def groups_per_user(group_dictionary):
15 | user_groups = {}
16 | # Go through group_dictionary
17 | for key,users in group_dictionary.items() :
18 | # Now go through the users in the group
19 | for user in users:
20 | if(user not in user_groups.keys()):
21 | user_groups[user]=[]
22 | user_groups[user].append(key)
23 | # Now add the group to the the list of
24 | # groups for this user, creating the entry
25 | # in the dictionary if necessary
26 |
27 | return(user_groups)
28 |
29 | print(groups_per_user({"local": ["admin", "userA"],
30 | "public": ["admin", "userB"],
31 | "administrator": ["admin"] }))
32 |
33 |
34 | #Q5:
35 |
36 | def add_prices(basket):
37 | # Initialize the variable that will be used for the calculation
38 | total = 0
39 | # Iterate through the dictionary items
40 | for key,value in basket.items():
41 | # Add each price to the total calculation
42 | # Hint: how do you access the values of
43 | # dictionary items?
44 | total += value
45 | # Limit the return value to 2 decimal places
46 | return round(total, 2)
47 |
48 | groceries = {"bananas": 1.56, "apples": 2.50, "oranges": 0.99, "bread": 4.59,
49 | "coffee": 6.99, "milk": 3.39, "eggs": 2.98, "cheese": 5.44}
50 |
51 | print(add_prices(groceries)) # Should print 28.44
52 |
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 4/video questions/Dictionaries vs Lists.py:
--------------------------------------------------------------------------------
1 | #In Python, a dictionary can only hold a single value for a given key.
2 | #To workaround this, our single value can be a list containing multiple values.
3 | #Here we have a dictionary called "wardrobe" with items of clothing and their colors.
4 | #Fill in the blanks to print a line for each item of clothing with each color,
5 | #for example: "red shirt", "blue shirt", and so on.
6 |
7 | #Solution:
8 |
9 | wardrobe = {"shirt":["red","blue","white"], "jeans":["blue","black"]}
10 | for key in wardrobe:
11 | for values in wardrobe[key]:
12 | print("{} {}".format(values,key))
13 |
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 4/video questions/Formatting Strings.py:
--------------------------------------------------------------------------------
1 | #Modify the student_grade function using the format method,
2 | #so that it returns the phrase "X received Y% on the exam".
3 | #For example, student_grade("Reed", 80) should return "Reed received 80% on the exam".
4 | #Solution:-
5 |
6 | def student_grade(name, grade):
7 | return "{} received {}% on the exam".format(name,grade)
8 |
9 | print(student_grade("Reed", 80))
10 | print(student_grade("Paige", 92))
11 | print(student_grade("Jesse", 85))
12 |
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 4/video questions/Iterating over the Contents of a Dictionary.py:
--------------------------------------------------------------------------------
1 | #Now, it's your turn! Have a go at iterating over a dictionary!
2 |
3 | #Complete the code to iterate through the keys and values of the cool_beasts dictionary.
4 | #Remember that the items method returns a tuple of key, value for each element in the dictionary.
5 |
6 | #Solution:
7 |
8 | cool_beasts = {"octopuses":"tentacles", "dolphins":"fins", "rhinos":"horns"}
9 | for animals,organ in cool_beasts.items():
10 | print("{} have {}".format(animals,organ))
11 |
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 4/video questions/List Comprehensions.py:
--------------------------------------------------------------------------------
1 | #The odd_numbers function returns a list of odd numbers between 1 and n, inclusively.
2 | #Fill in the blanks in the function, using list comprehension.
3 | #Hint: remember that list and range counters start at 0 and end at the limit minus 1.
4 |
5 |
6 | #Code:
7 |
8 | def odd_numbers(n):
9 | return [x for x in range (0,n+1) if x%2!=0]
10 |
11 | print(odd_numbers(5)) # Should print [1, 3, 5]
12 | print(odd_numbers(10)) # Should print [1, 3, 5, 7, 9]
13 | print(odd_numbers(11)) # Should print [1, 3, 5, 7, 9, 11]
14 | print(odd_numbers(1)) # Should print [1]
15 | print(odd_numbers(-1)) # Should print []
16 |
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 4/video questions/Lists and Tuples.py:
--------------------------------------------------------------------------------
1 | #Let's use tuples to store information about a file: its name,
2 | #its type and its size in bytes.
3 | #Fill in the gaps in this code to return the size in kilobytes (a kilobyte is 1024 bytes) up to 2 decimal places.
4 |
5 |
6 | #Code:
7 | def file_size(file_info):
8 | name, type, size= file_info
9 | return("{:.2f}".format(size / 1024))
10 |
11 | print(file_size(('Class Assignment', 'docx', 17875))) # Should print 17.46
12 | print(file_size(('Notes', 'txt', 496))) # Should print 0.48
13 | print(file_size(('Program', 'py', 1239))) # Should print 1.21
14 |
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 4/video questions/Modifying the Contents of a List.py:
--------------------------------------------------------------------------------
1 | #The skip_elements function returns a list containing every other element from an input list,
2 | #starting with the first element.
3 | #Complete this function to do that, using the for loop to iterate through the input list.
4 |
5 | #method-1
6 | def skip_elements(elements):
7 | new_list = []
8 | for index,element in enumerate(elements):
9 | if index == 0:
10 | new_list.append(element)
11 | elif (index % 2) == 0:
12 | new_list.append(element)
13 | return new_list
14 |
15 | print(skip_elements(["a", "b", "c", "d", "e", "f", "g"])) # Should be ['a', 'c', 'e', 'g']
16 | print(skip_elements(['Orange', 'Pineapple', 'Strawberry', 'Kiwi', 'Peach'])) # Should be ['Orange', 'Strawberry', 'Peach']
17 | print(skip_elements([])) # Should be []
18 |
19 |
20 | #method-2
21 | def skip_elememts(elements):
22 | return elements[::2]
23 | print(skip_elements(["a", "b", "c", "d", "e", "f", "g"])) # Should be ['a', 'c', 'e', 'g']
24 | print(skip_elements(['Orange', 'Pineapple', 'Strawberry', 'Kiwi', 'Peach'])) # Should be ['Orange', 'Strawberry', 'Peach']
25 | print(skip_elements([])) # Should be []
26 |
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 4/video questions/Video Question More String Method.py:
--------------------------------------------------------------------------------
1 | #Want to try some string methods yourself? Give it a go!
2 |
3 | #Fill in the gaps in the initials function so that it returns the initials of the words contained in the phrase received,
4 | #in upper case.
5 | #For example: "Universal Serial Bus" should return "USB"; "local area network" should return "LAN”.
6 | #solution:-
7 | def initials(phrase):
8 | words = phrase.split()
9 | result = ""
10 | for word in words:
11 | result += word[0].upper()
12 | return result
13 |
14 | print(initials("Universal Serial Bus")) # Should be: USB
15 | print(initials("local area network")) # Should be: LAN
16 | print(initials("Operating system")) # Should be: OS
17 |
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 4/video questions/What is Dictionary.py:
--------------------------------------------------------------------------------
1 | #The "toc" dictionary represents the table of contents for a book.
2 | #Fill in the blanks to do the following:
3 | #1) Add an entry for Epilogue on page 39.
4 | #2) Change the page number for Chapter 3 to 24.
5 | #3) Display the new dictionary contents.
6 | #4) Display True if there is Chapter 5, False if there isn't.
7 |
8 | #Solution:
9 | toc = {"Introduction":1, "Chapter 1":4, "Chapter 2":11, "Chapter 3":25, "Chapter 4":30}
10 | toc["Epilogue"] = 39
11 | toc["Chapter 3"]=24
12 | print(toc)
13 | print('Chapter 5' in toc)
14 |
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 4/video questions/What is a list.py:
--------------------------------------------------------------------------------
1 | #Using the "split" string method from the preceding lesson,
2 | #complete the get_word function to return the {n}th word from a passed sentence.
3 | #For example, get_word("This is a lesson about lists", 4) should return "lesson",
4 | #which is the 4th word in this sentence.
5 | #Hint: remember that list indexes start at 0, not 1.
6 |
7 | def get_word(sentence, n):
8 | # Only proceed if n is positive
9 | if n > 0:
10 | words = sentence.split()
11 | # Only proceed if n is not more than the number of words
12 | if n <= len(words):
13 | return(words[n-1])
14 | return("")
15 |
16 | print(get_word("This is a lesson about lists", 4)) # Should print: lesson
17 | print(get_word("This is a lesson about lists", -4)) # Nothing
18 | print(get_word("Now we are cooking!", 1)) # Should print: Now
19 | print(get_word("Now we are cooking!", 5)) # Nothing
20 |
21 |
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 4/video questions/files:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 5/Assessment - Object-oriented programming/solutions.ipynb:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 5/Assessment - Object-oriented programming/utf-8''C1M5_Object_Oriented_Programming_V7.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "# Assessment - Object-oriented programming"
8 | ]
9 | },
10 | {
11 | "cell_type": "markdown",
12 | "metadata": {},
13 | "source": [
14 | "In this exercise, we'll create a few classes to simulate a server that's taking connections from the outside and then a load balancer that ensures that there are enough servers to serve those connections. \n",
15 | "
\n",
16 | "To represent the servers that are taking care of the connections, we'll use a Server class. Each connection is represented by an id, that could, for example, be the IP address of the computer connecting to the server. For our simulation, each connection creates a random amount of load in the server, between 1 and 10.\n",
17 | "
\n",
18 | "Run the following code that defines this Server class."
19 | ]
20 | },
21 | {
22 | "cell_type": "code",
23 | "execution_count": 4,
24 | "metadata": {},
25 | "outputs": [],
26 | "source": [
27 | "#Begin Portion 1#\n",
28 | "import random\n",
29 | "\n",
30 | "class Server:\n",
31 | " def __init__(self):\n",
32 | " \"\"\"Creates a new server instance, with no active connections.\"\"\"\n",
33 | " self.connections = {}\n",
34 | "\n",
35 | " def add_connection(self, connection_id):\n",
36 | " \"\"\"Adds a new connection to this server.\"\"\"\n",
37 | " connection_load = random.random()*10+1\n",
38 | " # Add the connection to the dictionary with the calculated load\n",
39 | " self.connections[connection_id] = connection_load\n",
40 | " def close_connection(self, connection_id):\n",
41 | " \"\"\"Closes a connection on this server.\"\"\"\n",
42 | " # Remove the connection from the dictionary\n",
43 | " if connection_id in self.connections:\n",
44 | " del self.connections[connection_id]\n",
45 | " def load(self):\n",
46 | " \"\"\"Calculates the current load for all connections.\"\"\"\n",
47 | " total = 0\n",
48 | " for load in self.connections.values():\n",
49 | " total += load\n",
50 | " # Add up the load for each of the connections\n",
51 | " return total\n",
52 | "\n",
53 | " def __str__(self):\n",
54 | " \"\"\"Returns a string with the current load of the server\"\"\"\n",
55 | " return \"{:.2f}%\".format(self.load())\n",
56 | " \n",
57 | "#End Portion 1#"
58 | ]
59 | },
60 | {
61 | "cell_type": "markdown",
62 | "metadata": {},
63 | "source": [
64 | "Now run the following cell to create a Server instance and add a connection to it, then check the load:"
65 | ]
66 | },
67 | {
68 | "cell_type": "code",
69 | "execution_count": 5,
70 | "metadata": {},
71 | "outputs": [
72 | {
73 | "name": "stdout",
74 | "output_type": "stream",
75 | "text": [
76 | "6.654161114952463\n"
77 | ]
78 | }
79 | ],
80 | "source": [
81 | "server = Server()\n",
82 | "server.add_connection(\"192.168.1.1\")\n",
83 | "\n",
84 | "print(server.load())\n",
85 | "\n"
86 | ]
87 | },
88 | {
89 | "cell_type": "markdown",
90 | "metadata": {},
91 | "source": [
92 | "After running the above code cell, if you get a **NameError** message, be sure to run the Server class definition code block first.\n",
93 | "\n",
94 | "The output should be 0. This is because some things are missing from the Server class. So, you'll need to go back and fill in the blanks to make it behave properly. \n",
95 | "
\n",
96 | "Go back to the Server class definition and fill in the missing parts for the `add_connection` and `load` methods to make the cell above print a number different than zero. As the load is calculated randomly, this number should be different each time the code is executed.\n",
97 | "
\n",
98 | "**Hint:** Recall that you can iterate through the values of your connections dictionary just as you would any sequence."
99 | ]
100 | },
101 | {
102 | "cell_type": "markdown",
103 | "metadata": {},
104 | "source": [
105 | "Great! If your output is a random number between 1 and 10, you have successfully coded the `add_connection` and `load` methods of the Server class. Well done!\n",
106 | "
\n",
107 | "What about closing a connection? Right now the `close_connection` method doesn't do anything. Go back to the Server class definition and fill in the missing code for the `close_connection` method to make the following code work correctly:"
108 | ]
109 | },
110 | {
111 | "cell_type": "code",
112 | "execution_count": 7,
113 | "metadata": {
114 | "scrolled": true
115 | },
116 | "outputs": [
117 | {
118 | "name": "stdout",
119 | "output_type": "stream",
120 | "text": [
121 | "0\n"
122 | ]
123 | }
124 | ],
125 | "source": [
126 | "server.close_connection(\"192.168.1.1\")\n",
127 | "print(server.load())\n"
128 | ]
129 | },
130 | {
131 | "cell_type": "markdown",
132 | "metadata": {},
133 | "source": [
134 | "You have successfully coded the `close_connection` method if the cell above prints 0.\n",
135 | "
\n",
136 | "**Hint:** Remember that `del` dictionary[key] removes the item with key *key* from the dictionary."
137 | ]
138 | },
139 | {
140 | "cell_type": "markdown",
141 | "metadata": {},
142 | "source": [
143 | "Alright, we now have a basic implementation of the server class. Let's look at the basic LoadBalancing class. This class will start with only one server available. When a connection gets added, it will randomly select a server to serve that connection, and then pass on the connection to the server. The LoadBalancing class also needs to keep track of the ongoing connections to be able to close them. This is the basic structure:"
144 | ]
145 | },
146 | {
147 | "cell_type": "code",
148 | "execution_count": 8,
149 | "metadata": {},
150 | "outputs": [],
151 | "source": [
152 | "\n",
153 | "#Begin Portion 2#\n",
154 | "class LoadBalancing:\n",
155 | " def __init__(self):\n",
156 | " \"\"\"Initialize the load balancing system with one server\"\"\"\n",
157 | " self.connections = {}\n",
158 | " self.servers = [Server()]\n",
159 | "\n",
160 | " def add_connection(self, connection_id):\n",
161 | " \"\"\"Randomly selects a server and adds a connection to it.\"\"\"\n",
162 | " server = random.choice(self.servers)\n",
163 | " # Add the connection to the dictionary with the selected server\n",
164 | " # Add the connection to the server\n",
165 | " server.add_connection(connection_id)\n",
166 | " self.ensure_availability()\n",
167 | "\n",
168 | " def close_connection(self, connection_id):\n",
169 | " \"\"\"Closes the connection on the the server corresponding to connection_id.\"\"\"\n",
170 | " # Find out the right server\n",
171 | " # Close the connection on the server\n",
172 | " # Remove the connection from the load balancer\n",
173 | " for server in self.servers:\n",
174 | " if connection_id in server.connections:\n",
175 | " server.close_connection(connection_id)\n",
176 | " break\n",
177 | " \n",
178 | " def avg_load(self):\n",
179 | " \"\"\"Calculates the average load of all servers\"\"\"\n",
180 | " # Sum the load of each server and divide by the amount of servers\n",
181 | " total_load = 0\n",
182 | " total_server = 0\n",
183 | " for server in self.servers:\n",
184 | " total_load += server.load()\n",
185 | " total_server += 1\n",
186 | " return total_load/total_server\n",
187 | "\n",
188 | " def ensure_availability(self):\n",
189 | " \"\"\"If the average load is higher than 50, spin up a new server\"\"\"\n",
190 | " if self.avg_load() > 50:\n",
191 | " self.servers.append(Server())\n",
192 | "\n",
193 | " def __str__(self):\n",
194 | " \"\"\"Returns a string with the load for each server.\"\"\"\n",
195 | " loads = [str(server) for server in self.servers]\n",
196 | " return \"[{}]\".format(\",\".join(loads))\n",
197 | "#End Portion 2#"
198 | ]
199 | },
200 | {
201 | "cell_type": "markdown",
202 | "metadata": {},
203 | "source": [
204 | "As with the Server class, this class is currently incomplete. You need to fill in the gaps to make it work correctly. For example, this snippet should create a connection in the load balancer, assign it to a running server and then the load should be more than zero:"
205 | ]
206 | },
207 | {
208 | "cell_type": "code",
209 | "execution_count": 9,
210 | "metadata": {},
211 | "outputs": [
212 | {
213 | "name": "stdout",
214 | "output_type": "stream",
215 | "text": [
216 | "8.459701197451786\n"
217 | ]
218 | }
219 | ],
220 | "source": [
221 | "l = LoadBalancing()\n",
222 | "l.add_connection(\"fdca:83d2::f20d\")\n",
223 | "print(l.avg_load())\n"
224 | ]
225 | },
226 | {
227 | "cell_type": "markdown",
228 | "metadata": {},
229 | "source": [
230 | "After running the above code, the output is 0. Fill in the missing parts for the `add_connection` and `avg_load` methods of the LoadBalancing class to make this print the right load. Be sure that the load balancer now has an average load more than 0 before proceeding."
231 | ]
232 | },
233 | {
234 | "cell_type": "markdown",
235 | "metadata": {},
236 | "source": [
237 | "What if we add a new server?"
238 | ]
239 | },
240 | {
241 | "cell_type": "code",
242 | "execution_count": 10,
243 | "metadata": {},
244 | "outputs": [
245 | {
246 | "name": "stdout",
247 | "output_type": "stream",
248 | "text": [
249 | "4.229850598725893\n"
250 | ]
251 | }
252 | ],
253 | "source": [
254 | "l.servers.append(Server())\n",
255 | "print(l.avg_load())\n"
256 | ]
257 | },
258 | {
259 | "cell_type": "markdown",
260 | "metadata": {},
261 | "source": [
262 | "The average load should now be half of what it was before. If it's not, make sure you correctly fill in the missing gaps for the `add_connection` and `avg_load` methods so that this code works correctly. \n",
263 | "
\n",
264 | "**Hint:** You can iterate through the all servers in the *self.servers* list to get the total server load amount and then divide by the length of the *self.servers* list to compute the average load amount."
265 | ]
266 | },
267 | {
268 | "cell_type": "markdown",
269 | "metadata": {},
270 | "source": [
271 | "Fantastic! Now what about closing the connection?"
272 | ]
273 | },
274 | {
275 | "cell_type": "code",
276 | "execution_count": 11,
277 | "metadata": {},
278 | "outputs": [
279 | {
280 | "name": "stdout",
281 | "output_type": "stream",
282 | "text": [
283 | "0.0\n"
284 | ]
285 | }
286 | ],
287 | "source": [
288 | "l.close_connection(\"fdca:83d2::f20d\")\n",
289 | "print(l.avg_load())\n"
290 | ]
291 | },
292 | {
293 | "cell_type": "markdown",
294 | "metadata": {},
295 | "source": [
296 | "Fill in the code of the LoadBalancing class to make the load go back to zero once the connection is closed.\n",
297 | "
\n",
298 | "Great job! Before, we added a server manually. But we want this to happen automatically when the average load is more than 50%. To make this possible, fill in the missing code for the `ensure_availability` method and call it from the `add_connection` method after a connection has been added. You can test it with the following code:"
299 | ]
300 | },
301 | {
302 | "cell_type": "code",
303 | "execution_count": 12,
304 | "metadata": {},
305 | "outputs": [
306 | {
307 | "name": "stdout",
308 | "output_type": "stream",
309 | "text": [
310 | "[35.86%,79.73%,12.65%]\n"
311 | ]
312 | }
313 | ],
314 | "source": [
315 | "for connection in range(20):\n",
316 | " l.add_connection(connection)\n",
317 | "print(l)\n"
318 | ]
319 | },
320 | {
321 | "cell_type": "markdown",
322 | "metadata": {},
323 | "source": [
324 | "The code above adds 20 new connections and then prints the loads for each server in the load balancer. If you coded correctly, new servers should have been added automatically to ensure that the average load of all servers is not more than 50%.\n",
325 | "
\n",
326 | "Run the following code to verify that the average load of the load balancer is not more than 50%."
327 | ]
328 | },
329 | {
330 | "cell_type": "code",
331 | "execution_count": 13,
332 | "metadata": {},
333 | "outputs": [
334 | {
335 | "name": "stdout",
336 | "output_type": "stream",
337 | "text": [
338 | "42.74539449736478\n"
339 | ]
340 | }
341 | ],
342 | "source": [
343 | "print(l.avg_load())\n",
344 | "\n",
345 | "\n"
346 | ]
347 | },
348 | {
349 | "cell_type": "markdown",
350 | "metadata": {},
351 | "source": [
352 | "Awesome! If the average load is indeed less than 50%, you are all done with this assessment."
353 | ]
354 | }
355 | ],
356 | "metadata": {
357 | "kernelspec": {
358 | "display_name": "Python 3",
359 | "language": "python",
360 | "name": "python3"
361 | },
362 | "language_info": {
363 | "codemirror_mode": {
364 | "name": "ipython",
365 | "version": 3
366 | },
367 | "file_extension": ".py",
368 | "mimetype": "text/x-python",
369 | "name": "python",
370 | "nbconvert_exporter": "python",
371 | "pygments_lexer": "ipython3",
372 | "version": "3.6.7"
373 | },
374 | "widgets": {
375 | "application/vnd.jupyter.widget-state+json": {
376 | "state": {},
377 | "version_major": 2,
378 | "version_minor": 0
379 | }
380 | }
381 | },
382 | "nbformat": 4,
383 | "nbformat_minor": 2
384 | }
385 |
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 5/Assessment - Object-oriented programming/utf-8''C1M5_Object_Oriented_Programming_V7.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 5/Assessment - Object-oriented programming/utf-8''C1M5_Object_Oriented_Programming_V7.pdf
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 5/Code Reuse/Solution.ipynb:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 5/Code Reuse/utf-8''C1M5L3_Code_Reuse_V2.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "# Code Reuse"
8 | ]
9 | },
10 | {
11 | "cell_type": "markdown",
12 | "metadata": {},
13 | "source": [
14 | "Let’s put what we learned about code reuse all together. \n",
15 | "
\n",
16 | "First, let’s look back at **inheritance**. Run the following cell that defines a generic `Animal` class. "
17 | ]
18 | },
19 | {
20 | "cell_type": "code",
21 | "execution_count": 1,
22 | "metadata": {},
23 | "outputs": [],
24 | "source": [
25 | "class Animal:\n",
26 | " name = \"\"\n",
27 | " category = \"\"\n",
28 | " \n",
29 | " def __init__(self, name):\n",
30 | " self.name = name\n",
31 | " \n",
32 | " def set_category(self, category):\n",
33 | " self.category = category"
34 | ]
35 | },
36 | {
37 | "cell_type": "markdown",
38 | "metadata": {},
39 | "source": [
40 | "What we have is not enough to do much -- yet. That’s where you come in. \n",
41 | "
\n",
42 | "In the next cell, define a `Turtle` class that inherits from the `Animal` class. Then go ahead and set its category. For instance, a turtle is generally considered a reptile. Although modern cladistics call this categorization into question, for purposes of this exercise we will say turtles are reptiles! "
43 | ]
44 | },
45 | {
46 | "cell_type": "code",
47 | "execution_count": 5,
48 | "metadata": {},
49 | "outputs": [],
50 | "source": [
51 | "class Turtle(Animal):\n",
52 | " category=\"reptile\""
53 | ]
54 | },
55 | {
56 | "cell_type": "markdown",
57 | "metadata": {},
58 | "source": [
59 | "Run the following cell to check whether you correctly defined your `Turtle` class and set its category to reptile."
60 | ]
61 | },
62 | {
63 | "cell_type": "code",
64 | "execution_count": 6,
65 | "metadata": {},
66 | "outputs": [
67 | {
68 | "name": "stdout",
69 | "output_type": "stream",
70 | "text": [
71 | "reptile\n"
72 | ]
73 | }
74 | ],
75 | "source": [
76 | "print(Turtle.category)"
77 | ]
78 | },
79 | {
80 | "cell_type": "markdown",
81 | "metadata": {},
82 | "source": [
83 | "Was the output of the above cell reptile? If not, go back and edit your `Turtle` class making sure that it inherits from the `Animal` class and its category is properly set to reptile. Be sure to re-run that cell once you've finished your edits. Did you get it? If so, great!"
84 | ]
85 | },
86 | {
87 | "cell_type": "markdown",
88 | "metadata": {},
89 | "source": [
90 | "Next, let’s practice **composition** a little bit. This one will require a second type of `Animal` that is in the same category as the first. For example, since you already created a `Turtle` class, go ahead and create a `Snake` class. Don’t forget that it also inherits from the `Animal` class and that its category should be set to reptile."
91 | ]
92 | },
93 | {
94 | "cell_type": "code",
95 | "execution_count": 7,
96 | "metadata": {},
97 | "outputs": [],
98 | "source": [
99 | "class Snake(Animal):\n",
100 | " category=\"reptile\""
101 | ]
102 | },
103 | {
104 | "cell_type": "markdown",
105 | "metadata": {},
106 | "source": [
107 | "Now, let’s say we have a large variety of `Animal`s (such as turtles and snakes) in a Zoo. Below we have the `Zoo` class. We’re going to use it to organize our various `Animal`s. Remember, inheritance says a Turtle is an `Animal`, but a `Zoo` is not an `Animal` and an `Animal` is not a `Zoo` -- though they are related to one another. "
108 | ]
109 | },
110 | {
111 | "cell_type": "markdown",
112 | "metadata": {},
113 | "source": [
114 | "Fill in the blanks of the `Zoo` class below so that you can use **zoo.add_animal( )** to add instances of the `Animal` subclasses you created above. Once you’ve added them all, you should be able to use **zoo.total_of_category( )** to tell you exactly how many individual `Animal` types the `Zoo` has for each category! Be sure to run the cell once you've finished your edits."
115 | ]
116 | },
117 | {
118 | "cell_type": "code",
119 | "execution_count": 8,
120 | "metadata": {},
121 | "outputs": [],
122 | "source": [
123 | "class Zoo:\n",
124 | " def __init__(self):\n",
125 | " self.current_animals = {}\n",
126 | " \n",
127 | " def add_animal(self, animal):\n",
128 | " self.current_animals[animal.name] = animal.category\n",
129 | " \n",
130 | " def total_of_category(self, category):\n",
131 | " result = 0\n",
132 | " for animal in self.current_animals.values():\n",
133 | " if animal == category:\n",
134 | " result += 1\n",
135 | " return result\n",
136 | "\n",
137 | "zoo = Zoo()"
138 | ]
139 | },
140 | {
141 | "cell_type": "markdown",
142 | "metadata": {},
143 | "source": [
144 | "Run the following cell to check whether you properly filled in the blanks of your `Zoo` class."
145 | ]
146 | },
147 | {
148 | "cell_type": "code",
149 | "execution_count": 9,
150 | "metadata": {},
151 | "outputs": [
152 | {
153 | "name": "stdout",
154 | "output_type": "stream",
155 | "text": [
156 | "2\n"
157 | ]
158 | }
159 | ],
160 | "source": [
161 | "turtle = Turtle(\"Turtle\") #create an instance of the Turtle class\n",
162 | "snake = Snake(\"Snake\") #create an instance of the Snake class\n",
163 | "\n",
164 | "zoo.add_animal(turtle)\n",
165 | "zoo.add_animal(snake)\n",
166 | "\n",
167 | "print(zoo.total_of_category(\"reptile\")) #how many zoo animal types in the reptile category"
168 | ]
169 | },
170 | {
171 | "cell_type": "markdown",
172 | "metadata": {},
173 | "source": [
174 | "Was the output of the above cell 2? If not, go back and edit the `Zoo` class making sure to fill in the blanks with the appropriate attributes. Be sure to re-run that cell once you've finished your edits. \n",
175 | "
\n",
176 | "Did you get it? If so, perfect! You have successfully defined your `Turtle` and `Snake` subclasses as well as your `Zoo` class. You are all done with this notebook. Great work!"
177 | ]
178 | }
179 | ],
180 | "metadata": {
181 | "kernelspec": {
182 | "display_name": "Python 3",
183 | "language": "python",
184 | "name": "python3"
185 | },
186 | "language_info": {
187 | "codemirror_mode": {
188 | "name": "ipython",
189 | "version": 3
190 | },
191 | "file_extension": ".py",
192 | "mimetype": "text/x-python",
193 | "name": "python",
194 | "nbconvert_exporter": "python",
195 | "pygments_lexer": "ipython3",
196 | "version": "3.6.7"
197 | }
198 | },
199 | "nbformat": 4,
200 | "nbformat_minor": 2
201 | }
202 |
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 5/Code Reuse/utf-8''C1M5L3_Code_Reuse_V2.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 5/Code Reuse/utf-8''C1M5L3_Code_Reuse_V2.pdf
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 5/Methods and Classes/ utf-8''C1M5L2_Methods_and_Classes_V3.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "# Practice Notebook: Methods and Classes"
8 | ]
9 | },
10 | {
11 | "cell_type": "markdown",
12 | "metadata": {},
13 | "source": [
14 | "The code below defines an *Elevator* class. The elevator has a current floor, it also has a top and a bottom floor that are the minimum and maximum floors it can go to. Fill in the blanks to make the elevator go through the floors requested."
15 | ]
16 | },
17 | {
18 | "cell_type": "code",
19 | "execution_count": 3,
20 | "metadata": {},
21 | "outputs": [],
22 | "source": [
23 | "class Elevator:\n",
24 | " def __init__(self, bottom, top, current):\n",
25 | " \"\"\"Initializes the Elevator instance.\"\"\"\n",
26 | " self.bottom=bottom\n",
27 | " self.top=top\n",
28 | " self.current=current\n",
29 | " def __str__(self):\n",
30 | " \"\"\"Information about Current floor\"\"\"\n",
31 | " return \"Current floor: {}\".format(self.current)\n",
32 | " def up(self):\n",
33 | " \"\"\"Makes the elevator go up one floor.\"\"\"\n",
34 | " if self.current<10:\n",
35 | " self.current+=1\n",
36 | " def down(self):\n",
37 | " \"\"\"Makes the elevator go down one floor.\"\"\"\n",
38 | " if self.current > 0:\n",
39 | " self.current -= 1\n",
40 | " def go_to(self, floor):\n",
41 | " \"\"\"Makes the elevator go to the specific floor.\"\"\"\n",
42 | " if floor >= self.bottom and floor <= self.top:\n",
43 | " self.current = floor\n",
44 | " elif floor < 0:\n",
45 | " self.current = 0\n",
46 | " else:\n",
47 | " self.current = 10\n",
48 | "\n",
49 | "elevator = Elevator(-1, 10, 0)"
50 | ]
51 | },
52 | {
53 | "cell_type": "markdown",
54 | "metadata": {},
55 | "source": [
56 | "This class is pretty empty and doesn't do much. To test whether your *Elevator* class is working correctly, run the code blocks below."
57 | ]
58 | },
59 | {
60 | "cell_type": "code",
61 | "execution_count": 4,
62 | "metadata": {},
63 | "outputs": [
64 | {
65 | "data": {
66 | "text/plain": [
67 | "1"
68 | ]
69 | },
70 | "execution_count": 4,
71 | "metadata": {},
72 | "output_type": "execute_result"
73 | }
74 | ],
75 | "source": [
76 | "elevator.up() \n",
77 | "elevator.current #should output 1"
78 | ]
79 | },
80 | {
81 | "cell_type": "code",
82 | "execution_count": 5,
83 | "metadata": {},
84 | "outputs": [
85 | {
86 | "data": {
87 | "text/plain": [
88 | "0"
89 | ]
90 | },
91 | "execution_count": 5,
92 | "metadata": {},
93 | "output_type": "execute_result"
94 | }
95 | ],
96 | "source": [
97 | "elevator.down() \n",
98 | "elevator.current #should output 0"
99 | ]
100 | },
101 | {
102 | "cell_type": "code",
103 | "execution_count": 6,
104 | "metadata": {},
105 | "outputs": [
106 | {
107 | "data": {
108 | "text/plain": [
109 | "10"
110 | ]
111 | },
112 | "execution_count": 6,
113 | "metadata": {},
114 | "output_type": "execute_result"
115 | }
116 | ],
117 | "source": [
118 | "elevator.go_to(10) \n",
119 | "elevator.current #should output 10"
120 | ]
121 | },
122 | {
123 | "cell_type": "markdown",
124 | "metadata": {},
125 | "source": [
126 | "If you get a **NameError** message, be sure to run the *Elevator* class definition code block first. If you get an **AttributeError** message, be sure to initialize *self.current* in your *Elevator* class."
127 | ]
128 | },
129 | {
130 | "cell_type": "markdown",
131 | "metadata": {},
132 | "source": [
133 | "Once you've made the above methods output 1, 0 and 10, you've successfully coded the *Elevator* class and its methods. Great work!\n",
134 | "
\n",
135 | "For the up and down methods, did you take into account the top and bottom floors? Keep in mind that the elevator shouldn't go above the top floor or below the bottom floor. To check that out, try the code below and verify if it's working as expected. If it's not, then go back and modify the methods so that this code behaves correctly."
136 | ]
137 | },
138 | {
139 | "cell_type": "code",
140 | "execution_count": 7,
141 | "metadata": {},
142 | "outputs": [
143 | {
144 | "name": "stdout",
145 | "output_type": "stream",
146 | "text": [
147 | "9\n",
148 | "1\n"
149 | ]
150 | }
151 | ],
152 | "source": [
153 | "# Go to the top floor. Try to go up, it should stay. Then go down.\n",
154 | "elevator.go_to(10)\n",
155 | "elevator.up()\n",
156 | "elevator.down()\n",
157 | "print(elevator.current) # should be 9\n",
158 | "# Go to the bottom floor. Try to go down, it should stay. Then go up.\n",
159 | "elevator.go_to(-1)\n",
160 | "elevator.down()\n",
161 | "elevator.down()\n",
162 | "elevator.up()\n",
163 | "elevator.up()\n",
164 | "print(elevator.current) # should be 1"
165 | ]
166 | },
167 | {
168 | "cell_type": "markdown",
169 | "metadata": {},
170 | "source": [
171 | "Now add the __str__ method to your *Elevator* class definition above so that when printing the elevator using the **print( )** method, we get the current floor together with a message. For example, in the 5th floor it should say \"Current floor: 5\""
172 | ]
173 | },
174 | {
175 | "cell_type": "code",
176 | "execution_count": 8,
177 | "metadata": {},
178 | "outputs": [
179 | {
180 | "name": "stdout",
181 | "output_type": "stream",
182 | "text": [
183 | "Current floor: 5\n"
184 | ]
185 | }
186 | ],
187 | "source": [
188 | "elevator.go_to(5)\n",
189 | "print(elevator)"
190 | ]
191 | },
192 | {
193 | "cell_type": "markdown",
194 | "metadata": {},
195 | "source": [
196 | "Remember, Python uses the default method, that prints the position where the object is stored in the computer’s memory. If your output is something like:
\n",
197 | "> <__main__.Elevator object at 0x7ff6a9ff3fd0>\n",
198 | "\n",
199 | "Then you will need to add the special __str__ method, which returns the string that you want to print. Try again until you get the desired output, \"Current floor: 5\"."
200 | ]
201 | },
202 | {
203 | "cell_type": "markdown",
204 | "metadata": {},
205 | "source": [
206 | "Once you have successfully produced the desired output, you are all done with this practice notebook. Awesome!"
207 | ]
208 | }
209 | ],
210 | "metadata": {
211 | "kernelspec": {
212 | "display_name": "Python 3",
213 | "language": "python",
214 | "name": "python3"
215 | },
216 | "language_info": {
217 | "codemirror_mode": {
218 | "name": "ipython",
219 | "version": 3
220 | },
221 | "file_extension": ".py",
222 | "mimetype": "text/x-python",
223 | "name": "python",
224 | "nbconvert_exporter": "python",
225 | "pygments_lexer": "ipython3",
226 | "version": "3.6.7"
227 | },
228 | "widgets": {
229 | "application/vnd.jupyter.widget-state+json": {
230 | "state": {},
231 | "version_major": 2,
232 | "version_minor": 0
233 | }
234 | }
235 | },
236 | "nbformat": 4,
237 | "nbformat_minor": 2
238 | }
239 |
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 5/pquiz11.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 5/pquiz11.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 5/pquiz12.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 5/pquiz12.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 5/pquiz13.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 5/pquiz13.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 5/pquiz14.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 5/pquiz14.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 5/pquiz15.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 5/pquiz15.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 5/solutions.py:
--------------------------------------------------------------------------------
1 | #Q2
2 | # “If you have an apple and I have an apple and we exchange these apples then
3 | # you and I will still each have one apple. But if you have an idea and I have
4 | # an idea and we exchange these ideas, then each of us will have two ideas.”
5 | # George Bernard Shaw
6 |
7 | class Person:
8 | apples = 0
9 | ideas = 0
10 |
11 | johanna = Person()
12 | johanna.apples = 1
13 | johanna.ideas = 1
14 |
15 | martin = Person()
16 | martin.apples = 2
17 | martin.ideas = 1
18 |
19 | def exchange_apples(you, me):
20 | #Here, despite G.B. Shaw's quote, our characters have started with #different amounts of apples so we can better observe the results.
21 | #We're going to have Martin and Johanna exchange ALL their apples with #one another.
22 | #Hint: how would you switch values of variables,
23 | #so that "you" and "me" will exchange ALL their apples with one another?
24 | #Do you need a temporary variable to store one of the values?
25 | #You may need more than one line of code to do that, which is OK.
26 | temp=you.apples
27 | you.apples=me.apples
28 | me.apples=temp
29 | return you.apples, me.apples
30 |
31 | def exchange_ideas(you, me):
32 | #"you" and "me" will share our ideas with one another.
33 | #What operations need to be performed, so that each object receives
34 | #the shared number of ideas?
35 | #Hint: how would you assign the total number of ideas to
36 | #each idea attribute? Do you need a temporary variable to store
37 | #the sum of ideas, or can you find another way?
38 | #Use as many lines of code as you need here.
39 | you.ideas =me.ideas+you.ideas
40 | me.ideas =you.ideas
41 | return you.ideas, me.ideas
42 |
43 | exchange_apples(johanna, martin)
44 | print("Johanna has {} apples and Martin has {} apples".format(johanna.apples, martin.apples))
45 | exchange_ideas(johanna, martin)
46 | print("Johanna has {} ideas and Martin has {} ideas".format(johanna.ideas, martin.ideas))
47 |
48 |
49 |
50 | #Q3
51 | # define a basic city class
52 | class City:
53 | name = ""
54 | country = ""
55 | elevation = 0
56 | population = 0
57 |
58 | # create a new instance of the City class and
59 | # define each attribute
60 | city1 = City()
61 | city1.name = "Cusco"
62 | city1.country = "Peru"
63 | city1.elevation = 3399
64 | city1.population = 358052
65 |
66 | # create a new instance of the City class and
67 | # define each attribute
68 | city2 = City()
69 | city2.name = "Sofia"
70 | city2.country = "Bulgaria"
71 | city2.elevation = 2290
72 | city2.population = 1241675
73 |
74 | # create a new instance of the City class and
75 | # define each attribute
76 | city3 = City()
77 | city3.name = "Seoul"
78 | city3.country = "South Korea"
79 | city3.elevation = 38
80 | city3.population = 9733509
81 |
82 | def max_elevation_city(min_population):
83 | # Initialize the variable that will hold
84 | # the information of the city with
85 | # the highest elevation
86 | highest_elevation=0
87 | return_city =""
88 |
89 | # Evaluate the 1st instance to meet the requirements:
90 | # does city #1 have at least min_population and
91 | # is its elevation the highest evaluated so far?
92 | if (city1.population>min_population):
93 | if(highest_elevationmin_population):
100 | if (highest_elevationmin_population):
107 | if (highest_elevation 0:\n",
41 | " user_list = \", \".join(users)\n",
42 | " print(\"{}: {}\".format(machine, user_list))"
43 | ]
44 | },
45 | {
46 | "cell_type": "markdown",
47 | "metadata": {},
48 | "source": [
49 | "No output should be generated from running the custom function definitions above. To check that our code is doing everything it's supposed to do, we need an `Event` class. The code in the next cell below initializes our `Event` class. Go ahead and run this cell next."
50 | ]
51 | },
52 | {
53 | "cell_type": "code",
54 | "execution_count": 16,
55 | "metadata": {},
56 | "outputs": [],
57 | "source": [
58 | "class Event:\n",
59 | " def __init__(self, event_date, event_type, machine_name, user):\n",
60 | " self.date = event_date\n",
61 | " self.type = event_type\n",
62 | " self.machine = machine_name\n",
63 | " self.user = user"
64 | ]
65 | },
66 | {
67 | "cell_type": "markdown",
68 | "metadata": {},
69 | "source": [
70 | "Ok, we have an `Event` class that has a constructor and sets the necessary attributes. Next let's create some events and add them to a list by running the following cell."
71 | ]
72 | },
73 | {
74 | "cell_type": "code",
75 | "execution_count": 17,
76 | "metadata": {},
77 | "outputs": [],
78 | "source": [
79 | "events = [\n",
80 | " Event('2020-01-21 12:45:56', 'login', 'myworkstation.local', 'jordan'),\n",
81 | " Event('2020-01-22 15:53:42', 'logout', 'webserver.local', 'jordan'),\n",
82 | " Event('2020-01-21 18:53:21', 'login', 'webserver.local', 'lane'),\n",
83 | " Event('2020-01-22 10:25:34', 'logout', 'myworkstation.local', 'jordan'),\n",
84 | " Event('2020-01-21 08:20:01', 'login', 'webserver.local', 'jordan'),\n",
85 | " Event('2020-01-23 11:24:35', 'logout', 'mailserver.local', 'chris'),\n",
86 | "]"
87 | ]
88 | },
89 | {
90 | "cell_type": "markdown",
91 | "metadata": {},
92 | "source": [
93 | "Now we've got a bunch of events. Let's feed these events into our `custom_users` function and see what happens."
94 | ]
95 | },
96 | {
97 | "cell_type": "code",
98 | "execution_count": 18,
99 | "metadata": {},
100 | "outputs": [
101 | {
102 | "name": "stdout",
103 | "output_type": "stream",
104 | "text": [
105 | "{'webserver.local': {'lane'}, 'myworkstation.local': set(), 'mailserver.local': set()}\n"
106 | ]
107 | }
108 | ],
109 | "source": [
110 | "users = current_users(events)\n",
111 | "print(users)"
112 | ]
113 | },
114 | {
115 | "cell_type": "markdown",
116 | "metadata": {},
117 | "source": [
118 | "Uh oh. The code in the previous cell produces an error message. This is because we have a user in our `events` list that was logged out of a machine he was not logged into. Do you see which user this is? Make edits to the first cell containing our custom function definitions to see if you can fix this error message. There may be more than one way to do so. \n",
119 | "
\n",
120 | "Remember when you have finished making your edits, rerun that cell as well as the cell that feeds the `events` list into our `custom_users` function to see whether the error message has been fixed. Once the error message has been cleared and you have correctly outputted a dictionary with machine names as keys, your custom functions are properly finished. Great!"
121 | ]
122 | },
123 | {
124 | "cell_type": "markdown",
125 | "metadata": {},
126 | "source": [
127 | "Now try generating the report by running the next cell."
128 | ]
129 | },
130 | {
131 | "cell_type": "code",
132 | "execution_count": 19,
133 | "metadata": {},
134 | "outputs": [
135 | {
136 | "name": "stdout",
137 | "output_type": "stream",
138 | "text": [
139 | "webserver.local: lane\n"
140 | ]
141 | }
142 | ],
143 | "source": [
144 | "generate_report(users)"
145 | ]
146 | },
147 | {
148 | "cell_type": "markdown",
149 | "metadata": {},
150 | "source": [
151 | "Whoop whoop! Success! The error message has been cleared and the desired output is produced. You are all done with this practice notebook. Way to go!"
152 | ]
153 | },
154 | {
155 | "cell_type": "code",
156 | "execution_count": 20,
157 | "metadata": {},
158 | "outputs": [
159 | {
160 | "name": "stdout",
161 | "output_type": "stream",
162 | "text": [
163 | "webserver.local: lane\n"
164 | ]
165 | }
166 | ],
167 | "source": [
168 | "generate_report(users)"
169 | ]
170 | },
171 | {
172 | "cell_type": "code",
173 | "execution_count": null,
174 | "metadata": {},
175 | "outputs": [],
176 | "source": []
177 | }
178 | ],
179 | "metadata": {
180 | "kernelspec": {
181 | "display_name": "Python 3",
182 | "language": "python",
183 | "name": "python3"
184 | },
185 | "language_info": {
186 | "codemirror_mode": {
187 | "name": "ipython",
188 | "version": 3
189 | },
190 | "file_extension": ".py",
191 | "mimetype": "text/x-python",
192 | "name": "python",
193 | "nbconvert_exporter": "python",
194 | "pygments_lexer": "ipython3",
195 | "version": "3.6.7"
196 | }
197 | },
198 | "nbformat": 4,
199 | "nbformat_minor": 2
200 | }
201 |
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK 6/Practice Notebook - Putting It All Together/utf-8''C1M6L1_Putting_It_All_Together.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK 6/Practice Notebook - Putting It All Together/utf-8''C1M6L1_Putting_It_All_Together.pdf
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK3/Graded Assessment/gquiz1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK3/Graded Assessment/gquiz1.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK3/Graded Assessment/gquiz2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK3/Graded Assessment/gquiz2.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK3/Graded Assessment/gquiz3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK3/Graded Assessment/gquiz3.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK3/Graded Assessment/gquiz4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK3/Graded Assessment/gquiz4.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK3/Graded Assessment/gquiz5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK3/Graded Assessment/gquiz5.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK3/Graded Assessment/gquiz6.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK3/Graded Assessment/gquiz6.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK3/Graded Assessment/gquiz7.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK3/Graded Assessment/gquiz7.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK3/Graded Assessment/gquiz8.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK3/Graded Assessment/gquiz8.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK3/Graded Assessment/gquiz9.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK3/Graded Assessment/gquiz9.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK3/Graded Assessment/solutions.py:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK3/practice quiz 1/pquiz1-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK3/practice quiz 1/pquiz1-1.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK3/practice quiz 1/pquiz1-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK3/practice quiz 1/pquiz1-2.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK3/practice quiz 1/pquiz1-3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK3/practice quiz 1/pquiz1-3.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK3/practice quiz 1/pquiz1-4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK3/practice quiz 1/pquiz1-4.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK3/practice quiz 1/pquiz1-5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK3/practice quiz 1/pquiz1-5.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK3/practice quiz 1/solution.py:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK3/practice quiz 2/pquiz2-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK3/practice quiz 2/pquiz2-1.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK3/practice quiz 2/pquiz2-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK3/practice quiz 2/pquiz2-2.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK3/practice quiz 2/pquiz2-3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK3/practice quiz 2/pquiz2-3.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK3/practice quiz 2/solutions.py:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK3/practice quiz 3/pquiz3-1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK3/practice quiz 3/pquiz3-1.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK3/practice quiz 3/pquiz3-2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK3/practice quiz 3/pquiz3-2.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK3/practice quiz 3/pquiz3-3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK3/practice quiz 3/pquiz3-3.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK3/practice quiz 3/pquiz3-4.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK3/practice quiz 3/pquiz3-4.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK3/practice quiz 3/pquiz3-5.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Crash Course on Python/WEEK3/practice quiz 3/pquiz3-5.png
--------------------------------------------------------------------------------
/Crash Course on Python/WEEK3/practice quiz 3/solutions.py:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2020 Manav Narang
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Google-IT-Automation-with-Python-Professional-Certificate
2 | ## Crash course on python [Course 1 of 6 in the Google IT Automation with Python Specialization
3 |
4 | **To Access the Course:** [click here](https://www.coursera.org/learn/python-crash-course/)
5 |
6 | **WHAT YOU WILL LEARN**
7 |
8 | 1) Understand what Python is and why Python is relevant to automation
9 |
10 | 2) Write short Python scripts to perform automated actions
11 |
12 | 3) Understand how to use the basic Python structures: strings, lists, and dictionaries
13 |
14 | 4) Create your own Python objects
15 |
16 | ## About This Course
17 |
18 | This course is designed to teach you the foundations in order to write simple programs in Python using the most common structures. No previous exposure to programming is needed. By the end of this course, you'll understand the benefits of programming in IT roles; be able to write simple programs using Python; figure out how the building blocks of programming fit together; and combine all of this knowledge to solve a complex programming problem.
19 |
20 | We'll start off by diving into the basics of writing a computer program. Along the way, you’ll get hands-on experience with programming concepts through interactive exercises and real-world examples. You’ll quickly start to see how computers can perform a multitude of tasks — you just have to write code that tells them what to do.
21 |
22 | ## Applied Learning Project
23 |
24 | Learn how to program with Python with no previous knowledge of coding required and you’ll use Python to automate common system administration
25 | tasks
26 |
27 | Learn to use Git and GitHub, to troubleshoot and debug complex problems
28 |
29 | Apply automation at scale by using configuration management and the Cloud
30 |
31 | Practice your technical skills with hands-on projects including a capstone project where you’ll use your new knowledge to solve a real-world
32 | IT problem
33 |
34 | *About this Professional Certificate*
35 |
36 | This new beginner-level, six-course certificate, developed by Google, is designed to provide IT professionals with in-demand skills -- including
37 | Python, Git, and IT automation -- that can help you advance your career.
38 |
39 | Knowing how to write code to solve problems and automate solutions is a crucial skill for anybody in IT. Python, in particular, is now the most
40 | in-demand programming language by employers.
41 |
42 | This program builds on your IT foundations to help you take your career to the next level. It’s designed to teach you how to program with Python
43 | and how to use Python to automate common system administration tasks. You'll also learn to use Git and GitHub, troubleshoot and debug complex
44 | problems, and apply automation at scale by using configuration management and the Cloud.
45 |
46 | This certificate can be completed in about 6 months and is designed to prepare you for a variety of roles in IT, like more advanced IT Support
47 | Specialist or Junior Systems Administrator positions. Upon completing the program, you’ll have the option to share your information with potential
48 | employers, like Walmart, Sprint, Hulu, Bank of America, Google (of course!), and more.
49 |
50 | We recommend that you have Python installed on your machine. For some courses, you’ll need a computer where you can install Git or ask your administrator to install it for you.
51 |
52 | If you’d like to learn the fundamentals of IT support, check out the beginner level Google IT Support Professional Certificate.
53 |
54 |
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 1/Graded Assesment/scripts/Screenshot (30).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Using Python to Interact with the Operating System/WEEK 1/Graded Assesment/scripts/Screenshot (30).png
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 1/Graded Assesment/scripts/Screenshot (31).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Using Python to Interact with the Operating System/WEEK 1/Graded Assesment/scripts/Screenshot (31).png
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 1/Graded Assesment/scripts/Screenshot (32).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Using Python to Interact with the Operating System/WEEK 1/Graded Assesment/scripts/Screenshot (32).png
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 1/Graded Assesment/scripts/health_checks.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 | import shutil
3 | import psutil
4 | from network import *
5 |
6 | def check_disk_usage(disk):
7 | """Verifies that there's enough free space on disk"""
8 | du = shutil.disk_usage(disk)
9 | free = du.free / du.total * 100
10 | return free > 20
11 |
12 | def check_cpu_usage():
13 | """Verifies that there's enough unused CPU"""
14 | usage = psutil.cpu_percent(1)
15 | return usage < 75
16 |
17 | # If there's not enough disk, or not enough CPU, print an error
18 | if not check_disk_usage('/') or not check_cpu_usage():
19 | print("ERROR!")
20 | elif check_localhost() and check_connectivity():
21 | print("Everything ok")
22 |
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 1/Graded Assesment/scripts/network.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | import requests
4 | import socket
5 |
6 | def check_localhost():
7 | localhost = socket.gethostbyname('localhost')
8 | return localhost == '127.0.0.1'
9 |
10 | def check_connectivity():
11 | request = requests.get("http://www.google.com")
12 | return 200
13 |
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 1/Graded Assesment/scripts/readme.md:
--------------------------------------------------------------------------------
1 | # Qwiklabs Assessment: Working with Python Scripts
2 |
3 | ## Introduction
4 |
5 | In this lab, you'll first have to fix an incorrect Python script.
6 |
7 | ## What you’ll do
8 |
9 | * Fixing the file permissions to make it executable.
10 | * Fixing a bug in the code
11 |
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 1/Practice Quiz_ Automation/Screenshot (25).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Using Python to Interact with the Operating System/WEEK 1/Practice Quiz_ Automation/Screenshot (25).png
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 1/Practice Quiz_ Automation/Screenshot (26).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Using Python to Interact with the Operating System/WEEK 1/Practice Quiz_ Automation/Screenshot (26).png
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 1/Practice Quiz_ Automation/Screenshot (27).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Using Python to Interact with the Operating System/WEEK 1/Practice Quiz_ Automation/Screenshot (27).png
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 1/Practice Quiz_ Automation/Screenshot (28).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Using Python to Interact with the Operating System/WEEK 1/Practice Quiz_ Automation/Screenshot (28).png
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 1/Practice Quiz_ Automation/Screenshot (29).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Using Python to Interact with the Operating System/WEEK 1/Practice Quiz_ Automation/Screenshot (29).png
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 1/Practice Quiz_ Automation/Solution.py:
--------------------------------------------------------------------------------
1 | print("All the Solutions are in images")
2 |
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 1/Practice Quiz_ Getting Ready for Python/Screenshot (14).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Using Python to Interact with the Operating System/WEEK 1/Practice Quiz_ Getting Ready for Python/Screenshot (14).png
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 1/Practice Quiz_ Getting Ready for Python/Screenshot (15).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Using Python to Interact with the Operating System/WEEK 1/Practice Quiz_ Getting Ready for Python/Screenshot (15).png
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 1/Practice Quiz_ Getting Ready for Python/Screenshot (16).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Using Python to Interact with the Operating System/WEEK 1/Practice Quiz_ Getting Ready for Python/Screenshot (16).png
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 1/Practice Quiz_ Getting Ready for Python/Screenshot (17).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Using Python to Interact with the Operating System/WEEK 1/Practice Quiz_ Getting Ready for Python/Screenshot (17).png
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 1/Practice Quiz_ Getting Ready for Python/Solution.py:
--------------------------------------------------------------------------------
1 | print("All the solutions are in images")
2 |
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 1/Practice Quiz_ Running Python Locally/Screenshot (14).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Using Python to Interact with the Operating System/WEEK 1/Practice Quiz_ Running Python Locally/Screenshot (14).png
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 1/Practice Quiz_ Running Python Locally/Screenshot (15).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Using Python to Interact with the Operating System/WEEK 1/Practice Quiz_ Running Python Locally/Screenshot (15).png
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 1/Practice Quiz_ Running Python Locally/Screenshot (16).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Using Python to Interact with the Operating System/WEEK 1/Practice Quiz_ Running Python Locally/Screenshot (16).png
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 1/Practice Quiz_ Running Python Locally/Screenshot (17).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Using Python to Interact with the Operating System/WEEK 1/Practice Quiz_ Running Python Locally/Screenshot (17).png
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 1/Practice Quiz_ Running Python Locally/Screenshot (18).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Using Python to Interact with the Operating System/WEEK 1/Practice Quiz_ Running Python Locally/Screenshot (18).png
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 1/Practice Quiz_ Running Python Locally/Solution.py:
--------------------------------------------------------------------------------
1 | print("All the Solution are in Images")
2 |
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 2/Practice Notebook: Text Files/Solution.py:
--------------------------------------------------------------------------------
1 | print("Answers are attached in ipynb file")
2 |
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 2/Practice Notebook: Text Files/utf-8''C2M2L1_Reading_And_Writing_Files.ipynb:
--------------------------------------------------------------------------------
1 | {
2 | "cells": [
3 | {
4 | "cell_type": "markdown",
5 | "metadata": {},
6 | "source": [
7 | "# Practice Notebook: Reading and Writing Files"
8 | ]
9 | },
10 | {
11 | "cell_type": "markdown",
12 | "metadata": {},
13 | "source": [
14 | "In this exercise, we will test your knowledge of reading and writing files by playing around with some text files. \n",
15 | "
\n",
16 | "Let's say we have a text file containing current visitors at a hotel. We'll call it, *guests.txt*. Run the following code to create the file. The file will automatically populate with each initial guest's first name on its own line."
17 | ]
18 | },
19 | {
20 | "cell_type": "code",
21 | "execution_count": 1,
22 | "metadata": {},
23 | "outputs": [],
24 | "source": [
25 | "guests = open(\"guests.txt\", \"w\")\n",
26 | "initial_guests = [\"Bob\", \"Andrea\", \"Manuel\", \"Polly\", \"Khalid\"]\n",
27 | "\n",
28 | "for i in initial_guests:\n",
29 | " guests.write(i + \"\\n\")\n",
30 | " \n",
31 | "guests.close()"
32 | ]
33 | },
34 | {
35 | "cell_type": "markdown",
36 | "metadata": {},
37 | "source": [
38 | "No output is generated for the above code cell. To check the contents of the newly created *guests.txt* file, run the following code."
39 | ]
40 | },
41 | {
42 | "cell_type": "code",
43 | "execution_count": 2,
44 | "metadata": {},
45 | "outputs": [
46 | {
47 | "name": "stdout",
48 | "output_type": "stream",
49 | "text": [
50 | "Bob\n",
51 | "\n",
52 | "Andrea\n",
53 | "\n",
54 | "Manuel\n",
55 | "\n",
56 | "Polly\n",
57 | "\n",
58 | "Khalid\n",
59 | "\n"
60 | ]
61 | }
62 | ],
63 | "source": [
64 | "with open(\"guests.txt\") as guests:\n",
65 | " for line in guests:\n",
66 | " print(line)"
67 | ]
68 | },
69 | {
70 | "cell_type": "markdown",
71 | "metadata": {},
72 | "source": [
73 | "The output shows that our *guests.txt* file is correctly populated with each initial guest's first name on its own line. Cool!\n",
74 | "
\n",
75 | "Now suppose we want to update our file as guests check in and out. Fill in the missing code in the following cell to add guests to the *guests.txt* file as they check in."
76 | ]
77 | },
78 | {
79 | "cell_type": "code",
80 | "execution_count": 3,
81 | "metadata": {},
82 | "outputs": [],
83 | "source": [
84 | "new_guests = [\"Sam\", \"Danielle\", \"Jacob\"]\n",
85 | "\n",
86 | "with open(\"guests.txt\", \"a\") as guests:\n",
87 | " for i in new_guests:\n",
88 | " guests.write(i + \"\\n\")\n",
89 | "\n",
90 | "guests.close()"
91 | ]
92 | },
93 | {
94 | "cell_type": "markdown",
95 | "metadata": {},
96 | "source": [
97 | "To check whether your code correctly added the new guests to the *guests.txt* file, run the following cell."
98 | ]
99 | },
100 | {
101 | "cell_type": "code",
102 | "execution_count": 4,
103 | "metadata": {},
104 | "outputs": [
105 | {
106 | "name": "stdout",
107 | "output_type": "stream",
108 | "text": [
109 | "Bob\n",
110 | "\n",
111 | "Andrea\n",
112 | "\n",
113 | "Manuel\n",
114 | "\n",
115 | "Polly\n",
116 | "\n",
117 | "Khalid\n",
118 | "\n",
119 | "Sam\n",
120 | "\n",
121 | "Danielle\n",
122 | "\n",
123 | "Jacob\n",
124 | "\n"
125 | ]
126 | }
127 | ],
128 | "source": [
129 | "with open(\"guests.txt\") as guests:\n",
130 | " for line in guests:\n",
131 | " print(line)"
132 | ]
133 | },
134 | {
135 | "cell_type": "markdown",
136 | "metadata": {},
137 | "source": [
138 | "The current names in the *guests.txt* file should be: Bob, Andrea, Manuel, Polly, Khalid, Sam, Danielle and Jacob.\n",
139 | "
\n",
140 | "Was the *guests.txt* file correctly appended with the new guests? If not, go back and edit your code making sure to fill in the gaps appropriately so that the new guests are correctly added to the *guests.txt* file. Once the new guests are successfully added, you have filled in the missing code correctly. Great!\n",
141 | "
\n",
142 | "Now let's remove the guests that have checked out already. There are several ways to do this, however, the method we will choose for this exercise is outlined as follows:\n",
143 | "1. Open the file in \"read\" mode.\n",
144 | "2. Iterate over each line in the file and put each guest's name into a Python list.\n",
145 | "3. Open the file once again in \"write\" mode.\n",
146 | "4. Add each guest's name in the Python list to the file one by one.\n",
147 | "\n",
148 | "
\n",
149 | "Ready? Fill in the missing code in the following cell to remove the guests that have checked out already."
150 | ]
151 | },
152 | {
153 | "cell_type": "code",
154 | "execution_count": 5,
155 | "metadata": {},
156 | "outputs": [],
157 | "source": [
158 | "checked_out=[\"Andrea\", \"Manuel\", \"Khalid\"]\n",
159 | "temp_list=[]\n",
160 | "\n",
161 | "with open(\"guests.txt\", \"r\") as guests:\n",
162 | " for g in guests:\n",
163 | " temp_list.append(g.strip())\n",
164 | "\n",
165 | "with open(\"guests.txt\", \"w\") as guests:\n",
166 | " for name in temp_list:\n",
167 | " if name not in checked_out:\n",
168 | " guests.write(name + \"\\n\")"
169 | ]
170 | },
171 | {
172 | "cell_type": "markdown",
173 | "metadata": {},
174 | "source": [
175 | "To check whether your code correctly removed the checked out guests from the *guests.txt* file, run the following cell."
176 | ]
177 | },
178 | {
179 | "cell_type": "code",
180 | "execution_count": 6,
181 | "metadata": {},
182 | "outputs": [
183 | {
184 | "name": "stdout",
185 | "output_type": "stream",
186 | "text": [
187 | "Bob\n",
188 | "\n",
189 | "Polly\n",
190 | "\n",
191 | "Sam\n",
192 | "\n",
193 | "Danielle\n",
194 | "\n",
195 | "Jacob\n",
196 | "\n"
197 | ]
198 | }
199 | ],
200 | "source": [
201 | "with open(\"guests.txt\") as guests:\n",
202 | " for line in guests:\n",
203 | " print(line)"
204 | ]
205 | },
206 | {
207 | "cell_type": "markdown",
208 | "metadata": {},
209 | "source": [
210 | "The current names in the *guests.txt* file should be: Bob, Polly, Sam, Danielle and Jacob.\n",
211 | "
\n",
212 | "Were the names of the checked out guests correctly removed from the *guests.txt* file? If not, go back and edit your code making sure to fill in the gaps appropriately so that the checked out guests are correctly removed from the *guests.txt* file. Once the checked out guests are successfully removed, you have filled in the missing code correctly. Awesome!\n",
213 | "
\n",
214 | "Now let's check whether Bob and Andrea are still checked in. How could we do this? We'll just read through each line in the file to see if their name is in there. Run the following code to check whether Bob and Andrea are still checked in."
215 | ]
216 | },
217 | {
218 | "cell_type": "code",
219 | "execution_count": 7,
220 | "metadata": {},
221 | "outputs": [
222 | {
223 | "name": "stdout",
224 | "output_type": "stream",
225 | "text": [
226 | "Bob is checked in\n",
227 | "Andrea is not checked in\n"
228 | ]
229 | }
230 | ],
231 | "source": [
232 | "guests_to_check = ['Bob', 'Andrea']\n",
233 | "checked_in = []\n",
234 | "\n",
235 | "with open(\"guests.txt\",\"r\") as guests:\n",
236 | " for g in guests:\n",
237 | " checked_in.append(g.strip())\n",
238 | " for check in guests_to_check:\n",
239 | " if check in checked_in:\n",
240 | " print(\"{} is checked in\".format(check))\n",
241 | " else:\n",
242 | " print(\"{} is not checked in\".format(check))"
243 | ]
244 | },
245 | {
246 | "cell_type": "markdown",
247 | "metadata": {},
248 | "source": [
249 | "We can see that Bob is checked in while Andrea is not. Nice work! You've learned the basics of reading and writing files in Python!"
250 | ]
251 | }
252 | ],
253 | "metadata": {
254 | "kernelspec": {
255 | "display_name": "Python 3",
256 | "language": "python",
257 | "name": "python3"
258 | },
259 | "language_info": {
260 | "codemirror_mode": {
261 | "name": "ipython",
262 | "version": 3
263 | },
264 | "file_extension": ".py",
265 | "mimetype": "text/x-python",
266 | "name": "python",
267 | "nbconvert_exporter": "python",
268 | "pygments_lexer": "ipython3",
269 | "version": "3.6.7"
270 | }
271 | },
272 | "nbformat": 4,
273 | "nbformat_minor": 2
274 | }
275 |
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 2/Practice Notebook: Text Files/utf-8''C2M2L1_Reading_And_Writing_Files.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Using Python to Interact with the Operating System/WEEK 2/Practice Notebook: Text Files/utf-8''C2M2L1_Reading_And_Writing_Files.pdf
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 2/Practice Quiz: Managing Files & Directories/Screenshot (33).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Using Python to Interact with the Operating System/WEEK 2/Practice Quiz: Managing Files & Directories/Screenshot (33).png
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 2/Practice Quiz: Managing Files & Directories/Screenshot (34).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Using Python to Interact with the Operating System/WEEK 2/Practice Quiz: Managing Files & Directories/Screenshot (34).png
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 2/Practice Quiz: Managing Files & Directories/Screenshot (35).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Using Python to Interact with the Operating System/WEEK 2/Practice Quiz: Managing Files & Directories/Screenshot (35).png
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 2/Practice Quiz: Managing Files & Directories/Screenshot (36).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Using Python to Interact with the Operating System/WEEK 2/Practice Quiz: Managing Files & Directories/Screenshot (36).png
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 2/Practice Quiz: Managing Files & Directories/Screenshot (37).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Using Python to Interact with the Operating System/WEEK 2/Practice Quiz: Managing Files & Directories/Screenshot (37).png
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 2/Practice Quiz: Managing Files & Directories/solutions.py:
--------------------------------------------------------------------------------
1 | print("All the solutions are in images!")
2 |
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 2/Practice Quiz: Reading & Writing CSV Files/Screenshot (38).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Using Python to Interact with the Operating System/WEEK 2/Practice Quiz: Reading & Writing CSV Files/Screenshot (38).png
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 2/Practice Quiz: Reading & Writing CSV Files/Screenshot (39).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Using Python to Interact with the Operating System/WEEK 2/Practice Quiz: Reading & Writing CSV Files/Screenshot (39).png
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 2/Practice Quiz: Reading & Writing CSV Files/Screenshot (40).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Using Python to Interact with the Operating System/WEEK 2/Practice Quiz: Reading & Writing CSV Files/Screenshot (40).png
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 2/Practice Quiz: Reading & Writing CSV Files/Screenshot (41).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Using Python to Interact with the Operating System/WEEK 2/Practice Quiz: Reading & Writing CSV Files/Screenshot (41).png
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 2/Practice Quiz: Reading & Writing CSV Files/Screenshot (42).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Using Python to Interact with the Operating System/WEEK 2/Practice Quiz: Reading & Writing CSV Files/Screenshot (42).png
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 2/Practice Quiz: Reading & Writing CSV Files/Screenshot (43).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Using Python to Interact with the Operating System/WEEK 2/Practice Quiz: Reading & Writing CSV Files/Screenshot (43).png
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 2/Practice Quiz: Reading & Writing CSV Files/Screenshot (45).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Using Python to Interact with the Operating System/WEEK 2/Practice Quiz: Reading & Writing CSV Files/Screenshot (45).png
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 2/Practice Quiz: Reading & Writing CSV Files/solution.py:
--------------------------------------------------------------------------------
1 | print("All the solutions are in images")
2 |
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 2/Qwiklabs Assessment: Handling Files/Data/Report.txt:
--------------------------------------------------------------------------------
1 | Development:4
2 | Human Resources:2
3 | IT infrastructure:4
4 | Marketing:2
5 | Sales:3
6 | User Experience Research:2
7 | Vendor operations:2
8 |
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 2/Qwiklabs Assessment: Handling Files/Data/employees.csv:
--------------------------------------------------------------------------------
1 | Full Name, Username, Department
2 | Audrey Miller, audrey, Development
3 | Arden Garcia, ardeng, Sales
4 | Bailey Thomas, baileyt, Human Resources
5 | Blake Sousa, sousa, IT infrastructure
6 | Cameron Nguyen, nguyen, Marketing
7 | Charlie Grey, greyc, Development
8 | Chris Black, chrisb, User Experience Research
9 | Courtney Silva, silva, IT infrastructure
10 | Darcy Johnsonn, darcy, IT infrastructure
11 | Elliot Lamb, elliotl, Development
12 | Emery Halls, halls, Sales
13 | Flynn McMillan, flynn, Marketing
14 | Harley Klose, harley, Human Resources
15 | Jean May Coy, jeanm, Vendor operations
16 | Kay Stevens, kstev, Sales
17 | Lio Nelson, lion, User Experience Research
18 | Logan Tillas, tillas, Vendor operations
19 | Micah Lopes, micah, Development
20 | Sol Mansi, solm, IT infrastructure
21 |
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 2/Qwiklabs Assessment: Handling Files/Scripts/generate_report.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python3
2 |
3 | import csv
4 |
5 | def read_employees(csv_file_location):
6 | csv.register_dialect('empDialect', skipinitialspace=True, strict=True)
7 | employee_file = csv.DictReader(open(csv_file_location), dialect = 'empDialect')
8 | employee_list = []
9 | for data in employee_file:
10 | employee_list.append(data)
11 | return employee_list
12 |
13 | def process_data(employee_list):
14 | department_list = []
15 | for employee_data in employee_list:
16 | department_list.append(employee_data['Department'])
17 |
18 | department_data = {}
19 | for department_name in set(department_list):
20 | department_data[department_name] = department_list.count(department_name)
21 | return department_data
22 |
23 | def write_report(dictionary, report_file):
24 | with open(report_file, "w+") as f:
25 | for k in sorted(dictionary):
26 | f.write(str(k)+':'+str(dictionary[k])+'\n')
27 | f.close()
28 |
29 | employee_list = read_employees('/home/student-00-3bf8794a984/data/employees.csv')
30 | print(employee_list)
31 |
32 | dictionary = process_data(employee_list)
33 | print(dictionary)
34 |
35 | write_report(dictionary, '/home/student-00-3bf8794a984/data/report.txt')
36 |
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 2/Qwiklabs Assessment: Handling Files/readme.md:
--------------------------------------------------------------------------------
1 | # Qwiklabs Assessment: Handling Files
2 |
3 | ## Introduction
4 |
5 | For this lab, imagine you are an IT Specialist at a medium-sized company. The Human Resources Department at your company wants you to find out how many people are in each department. You need to write a Python script that reads a CSV file containing a list of the employees in the organization, counts how many people are in each department, and then generates a report using this information. The output of this script will be a plain text file.
6 |
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 3/Practice Quiz/Basic Regular Expressions/Screenshot (49).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Using Python to Interact with the Operating System/WEEK 3/Practice Quiz/Basic Regular Expressions/Screenshot (49).png
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 3/Practice Quiz/Basic Regular Expressions/Screenshot (50).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Using Python to Interact with the Operating System/WEEK 3/Practice Quiz/Basic Regular Expressions/Screenshot (50).png
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 3/Practice Quiz/Basic Regular Expressions/Screenshot (51).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Using Python to Interact with the Operating System/WEEK 3/Practice Quiz/Basic Regular Expressions/Screenshot (51).png
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 3/Practice Quiz/Basic Regular Expressions/Screenshot (52).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Using Python to Interact with the Operating System/WEEK 3/Practice Quiz/Basic Regular Expressions/Screenshot (52).png
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 3/Practice Quiz/Basic Regular Expressions/Screenshot (53).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Using Python to Interact with the Operating System/WEEK 3/Practice Quiz/Basic Regular Expressions/Screenshot (53).png
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 3/Practice Quiz/Basic Regular Expressions/Solution.py:
--------------------------------------------------------------------------------
1 | print("Solutions are in Images")
2 |
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 3/Practice Quiz/Reguar Expressions/Screenshot (46).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Using Python to Interact with the Operating System/WEEK 3/Practice Quiz/Reguar Expressions/Screenshot (46).png
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 3/Practice Quiz/Reguar Expressions/Screenshot (47).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Using Python to Interact with the Operating System/WEEK 3/Practice Quiz/Reguar Expressions/Screenshot (47).png
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 3/Practice Quiz/Reguar Expressions/Screenshot (48).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/manavnarang/Google-IT-Automation-with-Python-Professional-Certificate/ce982870f07cba8200947eda97764fcf8c7dc441/Using Python to Interact with the Operating System/WEEK 3/Practice Quiz/Reguar Expressions/Screenshot (48).png
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 3/Practice Quiz/Reguar Expressions/only check the photos.txt:
--------------------------------------------------------------------------------
1 |
2 |
--------------------------------------------------------------------------------
/Using Python to Interact with the Operating System/WEEK 3/Practice Quiz/Solutions.py:
--------------------------------------------------------------------------------
1 | print("Check the files out!!")
2 |
--------------------------------------------------------------------------------