This program is a simple Python application that generates random Quranic quotes. It demonstrates several fundamental programming skills including class definition, object instantiation, list manipulation, and random selection.
- Class Definition: The
Quote
class is defined to encapsulate the quote and its reference. - Object-Oriented Programming (OOP): Objects of the
Quote
class are instantiated to store individual quotes. - String Representation: The
__str__
method is overridden to provide a readable string representation of theQuote
objects. - List Manipulation: The quotes are stored in a list, showcasing how to manage collections of objects.
- Random Selection: The
random.choice
function is used to randomly select a quote from the list. - Function Definition: The
generate_quote
function is defined to encapsulate the logic for selecting a random quote.
- Ensure you have Python installed on your system.
- Copy the code below into a Python file, for example
quranic_quotes.py
. - Open your terminal or command prompt.
- Navigate to the directory containing the
quranic_quotes.py
file. - Run the program by typing
python quranic_quotes.py
.