In this series of exercises, we practice various refactoring techniques. You may want to run pylint on this script to find any pep8 compliance issues. Fix as much as issues you can.
-
Exercise 11: 'Introducing Explaining Variable' Technique
- Study the file gauge_eyeballs.py. Use 'Replace Temp with query' technique to improve readability of the code.
-
Exercise 12: 'Decompose Conditional' Technique
- Study the file detect_toxins.py. Use 'decompose conditional' technique to improve readability of the code.
-
Exercise 13: 'Consolidate Conditional Expression' Technique
- Study the file mix_ice_cream.py. Use 'consolidate conditional expression' technique to improve readability of the code.
-
Exercise 14: 'Consolidate Duplicate Conditional Fragments' Technique
- Study the file make_shirazi_salad.py Use 'consolidate duplicate conditional fragments' technique to improve readability of the code.
-
Exercise 15: 'Remove Control Flag' Technique
- Study the file find_food.py. Use 'remove control flag' technique to improve readability of the code.
-
Exercise 16: 'Replace Nested Conditional with Guard Clauses' Technique
- Study the file extract_position.py. Use 'Replace Nested Conditional with Guard Clauses' technique to improve readability of the code.
-
Exercise 17: 'Decompose Conditional' Technique
- Study check_cholesterol_levels.py file. Use 'decompose conditional' technique in combination with any other refactoring technique you've learned to improve readability/modularity of the code.
-
Exercise 18: 'Consolidate Duplicate Conditional Fragments' Technique
- Study change_gear.py file. Use 'consolidate duplicate conditional fragments' Technique to improve the code.
-
Exercise 19: 'Remove Control Flag' Technique
- Part 1: Refactor read_file.py
- Part 2: Refactor backdoor_method.py
- Use 'remove control flag' technique in combination with any other refactoring technique you've learned to improve readability of the code.
-
Exercise 20: 'Replace Nested Conditional With Guard Clauses' Technique
- Study calc_adjusted_capital.py. Use 'replace nested conditional with guarded clauses' technique in combination with any other refactoring technique you've learned to improve readability/modularity of the code.
Please submit your work to Gradescope.
- Submit your work for Exercise 12 to 20 at Refactoring - Simplifying Conditional Expressions