From a0deee49bf2de543e4fd536155461106d4291ad8 Mon Sep 17 00:00:00 2001 From: cheeks <134818917+leftovertoast@users.noreply.github.com> Date: Tue, 21 Jan 2025 15:47:18 -0500 Subject: [PATCH] Completed 4-14 PEP 8 & 4-15 Code Review, modified 4-1, 4-2, & 4-3 --- Chapter_04/4-14_pep8.py | 3 +++ Chapter_04/4-15_codeReview.py | 11 +++++++++++ Chapter_04/4-1_pizzas.py | 2 +- Chapter_04/4-2_animals.py | 6 +----- Chapter_04/4-3_countingToTwenty.py | 2 +- 5 files changed, 17 insertions(+), 7 deletions(-) create mode 100644 Chapter_04/4-14_pep8.py create mode 100644 Chapter_04/4-15_codeReview.py diff --git a/Chapter_04/4-14_pep8.py b/Chapter_04/4-14_pep8.py new file mode 100644 index 0000000..22e8630 --- /dev/null +++ b/Chapter_04/4-14_pep8.py @@ -0,0 +1,3 @@ +# Exercise 4-14 PEP 8 +# Learning Objective: Get familiar with https://python.org/dv/peps/pep-0008 +# No coding necessary for this exercise \ No newline at end of file diff --git a/Chapter_04/4-15_codeReview.py b/Chapter_04/4-15_codeReview.py new file mode 100644 index 0000000..a0bc404 --- /dev/null +++ b/Chapter_04/4-15_codeReview.py @@ -0,0 +1,11 @@ +# Exercise 4-15 Code Review +# Learning Objective: Modify 3 programs to comply with PEP 8. + +''' +Modified Programs: + +4-1 +4-2 +4-3 + +''' \ No newline at end of file diff --git a/Chapter_04/4-1_pizzas.py b/Chapter_04/4-1_pizzas.py index 868fb61..599d81e 100644 --- a/Chapter_04/4-1_pizzas.py +++ b/Chapter_04/4-1_pizzas.py @@ -4,6 +4,6 @@ favoritePizzas = ['Meat lovers', 'White with Spinach and Feta', 'Pepperoni'] for pizza in favoritePizzas: - print(f"I like {pizza} pizza. \n") + print(f"I like {pizza} pizza. \n") print("I really love pizza!") \ No newline at end of file diff --git a/Chapter_04/4-2_animals.py b/Chapter_04/4-2_animals.py index e68edec..04b1aa0 100644 --- a/Chapter_04/4-2_animals.py +++ b/Chapter_04/4-2_animals.py @@ -2,15 +2,11 @@ # Learning Objective: Same as 4-1, utilize for loop. animals = ['dog', 'cat', 'ferret'] - ''' for animal in animals: print(animal) ''' - #modified: - for animal in animals: - print(f"A {animal} would make a great pet. \n") - + print(f"A {animal} would make a great pet. \n") print("These animals all have 4 legs and make great pets!") \ No newline at end of file diff --git a/Chapter_04/4-3_countingToTwenty.py b/Chapter_04/4-3_countingToTwenty.py index 3d9bcaf..3c2146d 100644 --- a/Chapter_04/4-3_countingToTwenty.py +++ b/Chapter_04/4-3_countingToTwenty.py @@ -2,5 +2,5 @@ # Learning Objective: Use for loop and range method. for number in range(1, 21): - print(number) + print(number)