diff --git a/CHANGELOG.md b/CHANGELOG.md index 9872f30e67..230f88ed6b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -68,6 +68,7 @@ Types of change: ### Changed - [Html - Link Relative Paths - Change part of PQ as it wasn't worder properly](https://github.com/enkidevs/curriculum/pull/2985) - [Python - Format Text Paragraphs With Textwrap - Make the fill method more clear](https://github.com/enkidevs/curriculum/pull/2981) +- [Python - Advanced Queues - Move single-line commands to a single line, update indentation in codeblocks from 4 to 2 spaces](https://github.com/enkidevs/curriculum/pull/2988) - [Python - Playing With Time - Move single-line commands to a single line, update indentation in codeblocks from 4 to 2 spaces](https://github.com/enkidevs/curriculum/pull/3007) - [Python - Deep Into Collections - Move single-line commands to a single line, update indentation in codeblocks from 4 to 2 spaces](https://github.com/enkidevs/curriculum/pull/2997) - [Python - Python Functions - Move single-line commands to a single line, update indentation in codeblocks from 4 to 2 spaces](https://github.com/enkidevs/curriculum/pull/3008) diff --git a/python/python-core/advanced-queues/prioritize-your-queue.md b/python/python-core/advanced-queues/prioritize-your-queue.md index b1e82b6f0b..5e4b4b4487 100644 --- a/python/python-core/advanced-queues/prioritize-your-queue.md +++ b/python/python-core/advanced-queues/prioritize-your-queue.md @@ -31,18 +31,18 @@ It uses the sort method `sort` in order to decide what to retrieve from it first import queue class Enki(object): - def __init__(self, priority): - self.priority = priority - return - def __lt__(self, other): - return self.priority < other.priority + def __init__(self, priority): + self.priority = priority + return + def __lt__(self, other): + return self.priority < other.priority q = queue.PriorityQueue() q.put(Enki(55)) q.put(Enki(3)) q.put(Enki(100)) while not q.empty(): - print(q.get().priority) + print(q.get().priority) # output is 3 / 55 / 100 ``` @@ -52,18 +52,18 @@ If we want to reverse the sorting order (greatest priority first), we would have ```python class Enki(object): - def __init__(self, priority): - self.priority = priority - return - def __lt__(self, other): - return self.priority > other.priority + def __init__(self, priority): + self.priority = priority + return + def __lt__(self, other): + return self.priority > other.priority q = queue.PriorityQueue() q.put(Enki(55)) q.put(Enki(3)) q.put(Enki(100)) while not q.empty(): - print(q.get().priority) + print(q.get().priority) # output is 100 / 55 / 3 ``` diff --git a/python/python-core/advanced-queues/queue-s-and-threads.md b/python/python-core/advanced-queues/queue-s-and-threads.md index 19798a81b6..6f6c45bc8b 100644 --- a/python/python-core/advanced-queues/queue-s-and-threads.md +++ b/python/python-core/advanced-queues/queue-s-and-threads.md @@ -80,8 +80,7 @@ Complete the code snippet: q = Queue() ??? = 3 # declare 3 threads for i in range(num_threads): - worker = ??? \ - (target=enki, args=(q,)) + worker = ???(target=enki, args=(q,)) worker.setDaemon(True) worker.start() ```