Completed 4-14 PEP 8 & 4-15 Code Review, modified 4-1, 4-2, & 4-3
This commit is contained in:
parent
57900c59da
commit
a0deee49bf
3
Chapter_04/4-14_pep8.py
Normal file
3
Chapter_04/4-14_pep8.py
Normal file
@ -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
|
||||||
11
Chapter_04/4-15_codeReview.py
Normal file
11
Chapter_04/4-15_codeReview.py
Normal file
@ -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
|
||||||
|
|
||||||
|
'''
|
||||||
@ -4,6 +4,6 @@
|
|||||||
favoritePizzas = ['Meat lovers', 'White with Spinach and Feta', 'Pepperoni']
|
favoritePizzas = ['Meat lovers', 'White with Spinach and Feta', 'Pepperoni']
|
||||||
|
|
||||||
for pizza in favoritePizzas:
|
for pizza in favoritePizzas:
|
||||||
print(f"I like {pizza} pizza. \n")
|
print(f"I like {pizza} pizza. \n")
|
||||||
|
|
||||||
print("I really love pizza!")
|
print("I really love pizza!")
|
||||||
@ -2,15 +2,11 @@
|
|||||||
# Learning Objective: Same as 4-1, utilize for loop.
|
# Learning Objective: Same as 4-1, utilize for loop.
|
||||||
|
|
||||||
animals = ['dog', 'cat', 'ferret']
|
animals = ['dog', 'cat', 'ferret']
|
||||||
|
|
||||||
'''
|
'''
|
||||||
for animal in animals:
|
for animal in animals:
|
||||||
print(animal)
|
print(animal)
|
||||||
'''
|
'''
|
||||||
|
|
||||||
#modified:
|
#modified:
|
||||||
|
|
||||||
for animal in animals:
|
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!")
|
print("These animals all have 4 legs and make great pets!")
|
||||||
@ -2,5 +2,5 @@
|
|||||||
# Learning Objective: Use for loop and range method.
|
# Learning Objective: Use for loop and range method.
|
||||||
|
|
||||||
for number in range(1, 21):
|
for number in range(1, 21):
|
||||||
print(number)
|
print(number)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user