Week 3- Pythonic Code Flashcards
Pythonic code (16 cards)
What is an idiom in programming?
A particular way of writing code to perform a specific task.
What does the term ‘Pythonic’ refer to?
Python code that aligns with the Zen of Python principles.
Who is the author of the Zen of Python?
Tim Peters.
How many guiding principles are in the Zen of Python?
19.
What is the first principle of the Zen of Python?
Readable and Clear.
Fill in the blank: The Zen of Python emphasizes leveraging Python’s _______ and libraries.
Built-in Functions
What does the Zen of Python say about syntax?
It should avoid overly complex syntax.
What is the purpose of using context managers in Python according to the Zen of Python?
To manage resources effectively.
What does EAFP stand for in the Zen of Python?
Easier to Ask for Forgiveness than Permission.
What principle encourages the use of functions and classes with single responsibilities?
Write Functions and Classes with Single Responsibilities.
Which guideline does the Zen of Python encourage following?
PEP 8 Guidelines.
True or False: The Zen of Python promotes the use of list comprehensions and generators.
True.
What is emphasized by favoring iterators and iterables in Python?
Efficiency and memory usage.
Fill in the blank: The Zen of Python encourages using Python’s _______ structures effectively.
Data
What is a notable work that includes the Zen of Python lyrics?
A song by Barry Warsaw.
In what year did Barry Warsaw use the Zen of Python as lyrics to a song?
2020.