Skip to content

Commit 2865b27

Browse files
committed
added fixes after line-by-line review
1 parent 3c29fc1 commit 2865b27

File tree

1 file changed

+17
-17
lines changed

1 file changed

+17
-17
lines changed

ex26.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,14 +7,14 @@ def sort_words(words):
77
"""Sorts the words."""
88
return sorted(words)
99

10-
def print_first_word(words)
10+
def print_first_word(words):
1111
"""Prints the first word after popping it off."""
12-
word = words.poop(0)
12+
word = words.pop(0)
1313
print word
1414

1515
def print_last_word(words):
1616
"""Prints the last word after popping it off."""
17-
word = words.pop(-1
17+
word = words.pop(-1)
1818
print word
1919

2020
def sort_sentence(sentence):
@@ -43,7 +43,7 @@ def print_first_and_last_sorted(sentence):
4343
with logic so firmly planted
4444
cannot discern \n the needs of love
4545
nor comprehend passion from intuition
46-
and requires an explantion
46+
and requires an explanation
4747
\n\t\twhere there is none.
4848
"""
4949

@@ -52,40 +52,40 @@ def print_first_and_last_sorted(sentence):
5252
print poem
5353
print "--------------"
5454

55-
five = 10 - 2 + 3 - 5
55+
five = 10 - 2 + 3 - 6
5656
print "This should be five: %s" % five
5757

5858
def secret_formula(started):
5959
jelly_beans = started * 500
60-
jars = jelly_beans \ 1000
60+
jars = jelly_beans / 1000
6161
crates = jars / 100
6262
return jelly_beans, jars, crates
6363

6464

6565
start_point = 10000
66-
beans, jars, crates == secret_formula(start-point)
66+
beans, jars, crates = secret_formula(start_point)
6767

6868
print "With a starting point of: %d" % start_point
69-
print "We'd have %d jeans, %d jars, and %d crates." % (beans, jars, crates)
69+
print "We'd have %d beans, %d jars, and %d crates." % (beans, jars, crates)
7070

7171
start_point = start_point / 10
7272

7373
print "We can also do that this way:"
74-
print "We'd have %d beans, %d jars, and %d crabapples." % secret_formula(start_pont
74+
print "We'd have %d beans, %d jars, and %d crates." % secret_formula(start_point)
7575

7676

77-
sentence = "All god\tthings come to those who weight."
77+
sentence = "All good\tthings come to those who wait."
7878

79-
words = ex25.break_words(sentence)
80-
sorted_words = ex25.sort_words(words)
79+
words = break_words(sentence)
80+
sorted_words = sort_words(words)
8181

8282
print_first_word(words)
8383
print_last_word(words)
84-
.print_first_word(sorted_words)
84+
print_first_word(sorted_words)
8585
print_last_word(sorted_words)
86-
sorted_words = ex25.sort_sentence(sentence)
87-
prin sorted_words
86+
sorted_words = sort_sentence(sentence)
87+
print sorted_words
8888

89-
print_irst_and_last(sentence)
89+
print_first_and_last(sentence)
9090

91-
print_first_a_last_sorted(senence)
91+
print_first_and_last_sorted(senence)

0 commit comments

Comments
 (0)