{"id":25811,"date":"2021-12-16T09:19:33","date_gmt":"2021-12-16T03:49:33","guid":{"rendered":"https:\/\/python-programs.com\/?p=25811"},"modified":"2021-12-16T09:19:33","modified_gmt":"2021-12-16T03:49:33","slug":"python-program-to-generate-random-quotes-from-quote-module","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-generate-random-quotes-from-quote-module\/","title":{"rendered":"Python Program to Generate Random Quotes from quote Module"},"content":{"rendered":"
How to Generate a keyword at random?<\/h5>\n

To get quotes from different backgrounds, we will generate a random keyword each time, and the program will return a quote from a specific author centered on the keyword.<\/p>\n

We use the random_word<\/strong> module to get any random English word. The random_word module can produce a single random word or a list of random words.<\/p>\n

Before going to the code, install the random_word<\/strong> module as shown below<\/p>\n

pip install random_word<\/span><\/pre>\n

Output:<\/strong><\/p>\n

Collecting random_word Downloading Random_Word-1.0.7-py3-none-any.whl (8.0 kB)\r\n Requirement already satisfied: requests in \/usr\/local\/lib\/python3.7\/\r\ndist-packages (from random_word) (2.23.0) Collecting nose Downloading \r\nnose-1.3.7-py3-none-any.whl (154 kB) |\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588| \r\n154 kB 8.6 MB\/s Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,\r\n<1.26,>=1.21.1 in \/usr\/local\/lib\/python3.7\/dist-packages (from requests->\r\nrandom_word) (1.24.3) Requirement already satisfied: idna<3,>=2.5 in \/usr\/\r\nlocal\/lib\/python3.7\/dist-packages (from requests->random_word) (2.10) \r\nRequirement already satisfied: certifi>=2017.4.17 in \/usr\/local\/lib\/python3.7\/\r\ndist-packages (from requests->random_word) (2021.10.8) Requirement already\r\n satisfied: chardet<4,>=3.0.2 in \/usr\/local\/lib\/python3.7\/dist-packages \r\n(from requests->random_word) (3.0.4) Installing collected packages: nose, \r\nrandom-word Successfully installed nose-1.3.7 random-word-1.0.7<\/pre>\n
pip install quote<\/pre>\n

Output:<\/strong><\/p>\n

Collecting quote Downloading quote-2.0.4.tar.gz (4.1 kB) Collecting gazpacho>=1.0\r\nDownloading gazpacho-1.1.tar.gz (7.9 kB) Installing build dependencies ... done\r\nGetting requirements to build wheel ... done Preparing wheel metadata ... done\r\nBuilding wheels for collected packages: quote, gazpacho Building wheel for quote\r\n(setup.py) ... done Created wheel for quote: filename=quote-2.0.4-py3-none-any.\r\nwhl size=5005 sha256=2afb78d9fe4304db45fa2462ec1e37f927bf09c39485859da3b0bb3f6b\r\n7be7bc Stored in directory: \/root\/.cache\/pip\/wheels\/74\/8c\/7d\/2670c2479ed9ff454b\r\n92c11a0459b9f8dcbc461ede57f8a493 Building wheel for gazpacho (PEP 517) ... done\r\nCreated wheel for gazpacho: filename=gazpacho-1.1-py3-none-any.whl size=7483\r\nsha256=0dd0461047f3c9b88afa32b3c0411b2a29a503006323d10d30c45544683637f6 Stored\r\nin directory: \/root\/.cache\/pip\/wheels\/db\/6b\/a2\/486f272d5e523b56bd19817c14ef35e\r\nc1850644dea78f9dd76 Successfully built quote gazpacho Installing collected \r\npackages: gazpacho, quote Successfully installed gazpacho-1.1 quote-2.0.4<\/pre>\n

Program to Generate Random Quotes from quote Module in Python<\/h2>\n