From 76edfa485f6453d19b0b57e6de0d92b9a95df2c2 Mon Sep 17 00:00:00 2001 From: Sharif Saleki Date: Thu, 28 Feb 2019 00:43:23 -0500 Subject: [PATCH 1/2] BF: Replaced variable from previous loop with the one from the printing loop --- _sources/Sorting/SortingaDictionary.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_sources/Sorting/SortingaDictionary.rst b/_sources/Sorting/SortingaDictionary.rst index 364069b4..d41dd22a 100644 --- a/_sources/Sorting/SortingaDictionary.rst +++ b/_sources/Sorting/SortingaDictionary.rst @@ -91,7 +91,7 @@ Here's a version of that using a named function. # now loop through the keys for k in y: - print("{} appears {} times".format(x, d[x])) + print("{} appears {} times".format(k, d[k])) .. note:: From 5943b26e41c1bc8aa86b5d38ee94c975a33840c7 Mon Sep 17 00:00:00 2001 From: Sharif Saleki Date: Sun, 3 Mar 2019 21:16:55 -0500 Subject: [PATCH 2/2] Changed print statement syntax to python3 --- _sources/Classes/sorting_instances.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/_sources/Classes/sorting_instances.rst b/_sources/Classes/sorting_instances.rst index 5de7b964..43935e7c 100644 --- a/_sources/Classes/sorting_instances.rst +++ b/_sources/Classes/sorting_instances.rst @@ -56,11 +56,11 @@ Sometimes you will find it convenient to define a method for the class that does return self.price L = [Fruit("Cherry", 10), Fruit("Apple", 5), Fruit("Blueberry", 20)] - print "-----sorted by price, referencing a class method-----" + print("-----sorted by price, referencing a class method-----") for f in sorted(L, key=Fruit.sort_priority): print(f.name) - print "---- one more way to do the same thing-----" + print("---- one more way to do the same thing-----") for f in sorted(L, key=lambda x: x.sort_priority()): print(f.name)