{"id":329293,"date":"2022-02-08T21:00:40","date_gmt":"2022-02-08T21:00:40","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=329293"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=329293","title":{"rendered":"<span>\u041a\u043d\u0438\u0433\u0430 \u00ab\u0411\u043e\u043b\u044c\u0448\u0430\u044f \u043a\u043d\u0438\u0433\u0430 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u0432 Python\u00bb<\/span>"},"content":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><a href=\"https:\/\/habr.com\/ru\/company\/piter\/blog\/598341\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/z7\/yi\/kx\/z7yikxxmn_aouxb1hm-bkwv-qqg.jpeg\" align=\"left\" alt=\"image\" data-src=\"https:\/\/habrastorage.org\/webt\/z7\/yi\/kx\/z7yikxxmn_aouxb1hm-bkwv-qqg.jpeg\" data-blurred=\"true\"\/><\/a> \u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440\u043e\u0436\u0438\u0442\u0435\u043b\u0438! \u0412\u044b \u0443\u0436\u0435 \u043e\u0441\u0432\u043e\u0438\u043b\u0438 \u043e\u0441\u043d\u043e\u0432\u044b \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 Python \u0438 \u0433\u043e\u0442\u043e\u0432\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c? \u041e\u0442\u0442\u043e\u0447\u0438\u0442\u0435 \u0441\u0432\u043e\u0438 \u043d\u0430\u0432\u044b\u043a\u0438 \u043d\u0430 \u0441\u0430\u043c\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447\u0430\u0445 \u2014 \u0433\u0440\u0430\u0444\u0438\u043a\u0435, \u0438\u0433\u0440\u0430\u0445, \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438, \u0440\u0430\u0441\u0447\u0435\u0442\u0430\u0445 \u0438 \u043c\u043d\u043e\u0433\u043e\u043c \u0434\u0440\u0443\u0433\u043e\u043c. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044f \u043a \u0433\u043e\u0442\u043e\u0432\u044b\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u043c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0434\u0435\u0442\u0430\u043b\u0438.\u0412 256 \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u0441\u044f \u0432\u0441\u0435 \u2014 \u00ab\u0432\u0438\u043d\u0442\u0430\u0436\u043d\u0430\u044f\u00bb \u044d\u043a\u0440\u0430\u043d\u043d\u0430\u044f \u0437\u0430\u0441\u0442\u0430\u0432\u043a\u0430, \u0437\u0430\u0431\u0435\u0433 \u0443\u043b\u0438\u0442\u043e\u043a \u043d\u0430 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c, \u0440\u0435\u043a\u043b\u0430\u043c\u043d\u044b\u0439 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a-\u043f\u0440\u0438\u043c\u0430\u043d\u043a\u0430, \u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0430\u044f\u0441\u044f \u0441\u043f\u0438\u0440\u0430\u043b\u044c \u0414\u041d\u041a \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435. \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u043a \u044d\u0442\u043e\u043c\u0443 \u043f\u0430\u0440\u0443 \u0441\u0442\u0440\u043e\u043a \u0441\u0432\u043e\u0435\u0433\u043e \u043a\u043e\u0434\u0430, \u0438 \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c\u0438 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u043c\u0438 \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435.<\/p>\n<p>  \u0427\u0422\u041e \u0412\u041d\u0423\u0422\u0420\u0418?<br \/>  \u2022 \u00ab\u0432\u0438\u0441\u0435\u043b\u0438\u0446\u0430\u00bb, \u0431\u043b\u0435\u043a-\u0434\u0436\u0435\u043a \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0438\u0433\u0440\u044b, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0433\u0440\u0430\u0442\u044c \u0441\u0430\u043c\u043e\u043c\u0443 \u0438\u043b\u0438 \u0441 \u0434\u0440\u0443\u0437\u044c\u044f\u043c\u0438;<br \/>  \u2022 \u0438\u043c\u0438\u0442\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u043b\u0435\u0441\u043d\u044b\u0445 \u043f\u043e\u0436\u0430\u0440\u043e\u0432, \u0431\u0440\u043e\u0441\u043a\u043e\u0432 \u0438\u0433\u0440\u0430\u043b\u044c\u043d\u044b\u0445 \u043a\u043e\u0441\u0442\u0435\u0439 \u0438 \u044f\u043f\u043e\u043d\u0441\u043a\u0438\u0445 \u0441\u0447\u0435\u0442\u043e\u0432-\u0430\u0431\u0430\u043a\u0438;<br \/>  \u2022 \u0430\u043d\u0438\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0430\u043a\u0432\u0430\u0440\u0438\u0443\u043c\u0430, \u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0435\u0433\u043e\u0441\u044f \u043a\u0443\u0431\u0430 \u0438 \u043b\u043e\u0433\u043e\u0442\u0438\u043f\u0430 DVD, \u043e\u0442\u0441\u043a\u0430\u043a\u0438\u0432\u0430\u044e\u0449\u0435\u0433\u043e \u043e\u0442 \u043a\u0440\u0430\u0435\u0432 \u044d\u043a\u0440\u0430\u043d\u0430;<br \/>  \u2022 \u0442\u0440\u0435\u0445\u043c\u0435\u0440\u043d\u0430\u044f \u00ab\u0431\u0440\u043e\u0434\u0438\u043b\u043a\u0430\u00bb \u043f\u043e \u043b\u0430\u0431\u0438\u0440\u0438\u043d\u0442\u0443;<br \/>  \u2022 \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u044f, \u0448\u0438\u0444\u0440\u044b \u0412\u0438\u0436\u0435\u043d\u0435\u0440\u0430 \u0438 ROT13, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0435 \u043d\u0430\u0434\u0435\u0436\u043d\u043e \u0441\u043f\u0440\u044f\u0442\u0430\u0442\u044c \u0432\u0430\u0448 \u0442\u0435\u043a\u0441\u0442.<br \/>  <a name=\"habracut\"><\/a>  <\/p>\n<h2>\u0413\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432-\u043f\u0440\u0438\u043c\u0430\u043d\u043e\u043a<\/h2>\n<p>  \u041d\u0430\u0448\u0435\u043c\u0443 \u0441\u0430\u0439\u0442\u0443 \u043d\u0443\u0436\u043d\u043e \u043a\u0430\u043a-\u0442\u043e \u0437\u0430\u043c\u0430\u043d\u0438\u0432\u0430\u0442\u044c \u043b\u044e\u0434\u0435\u0439 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0440\u0435\u043a\u043b\u0430\u043c\u0443! \u041d\u043e \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0435\u043d\u0442 \u043d\u0435\u043f\u0440\u043e\u0441\u0442\u043e. \u041a \u0441\u0447\u0430\u0441\u0442\u044c\u044e, \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u0430 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432-\u043f\u0440\u0438\u043c\u0430\u043d\u043e\u043a \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440 \u0441\u043c\u043e\u0436\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u044b \u0448\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u0445 \u0444\u0438\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432. \u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u0438\u0445 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u043e \u2014 \u043e\u0447\u0435\u043d\u044c \u043d\u0438\u0437\u043a\u043e\u0435, \u043d\u043e \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u0439, \u043f\u043e\u0445\u043e\u0436\u0435, \u044d\u0442\u043e \u043d\u0435 \u0441\u043c\u0443\u0449\u0430\u0435\u0442. \u0414\u0430\u043d\u043d\u0430\u044f \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u0435\u0442 \u043b\u044e\u0431\u043e\u0435 \u043d\u0443\u0436\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432 \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0432 \u0441\u0442\u0438\u043b\u0435 \u0438\u0433\u0440\u044b Mad Libs.<\/p>\n<p>  \u0412 \u044d\u0442\u043e\u0439 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u043c\u043d\u043e\u0433\u043e \u0442\u0435\u043a\u0441\u0442\u0430 \u0434\u043b\u044f \u0448\u0430\u0431\u043b\u043e\u043d\u043e\u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432, \u043d\u043e \u0441\u0430\u043c \u043a\u043e\u0434 \u043f\u0440\u043e\u0441\u0442 \u0438 \u0432\u043f\u043e\u043b\u043d\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u0435\u043d \u0434\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0445.<\/p>\n<h3>\u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0432 \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0438<\/h3>\n<p>  \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f clickbait.py \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<pre><code class=\"python\">Clickbait Headline Generator By Al Sweigart al@inventwithpython.com  Our website needs to trick people into looking at ads! Enter the number of clickbait headlines to generate: > 1000 Big Companies Hate Him! See How This New York Cat Invented a Cheaper Robot What Telephone Psychics Don't Want You To Know About Avocados You Won't Believe What This North Carolina Shovel Found in Her Workplace --\u0441\u043e\u043a\u0440\u0430\u0449\u0435\u043d\u043e-- 14 Reasons Why Parents Are More Interesting Than You Think (Number 1 Will Surprise You!) What Robots Don't Want You To Know About Cats This Florida Telephone Psychic Didn't Think Robots Would Take Her Job. She Was Wrong. <\/code><\/pre>\n<p>  <\/p>\n<h3>\u041e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0440\u0430\u0431\u043e\u0442\u044b<\/h3>\n<p>  \u041f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u0432\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0434\u043b\u044f \u0433\u0435\u043d\u0435\u0440\u0430\u0446\u0438\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0432\u0438\u0434\u043e\u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432-\u043f\u0440\u0438\u043c\u0430\u043d\u043e\u043a, \u043f\u043e\u043b\u0443\u0447\u0430\u044e\u0449\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u044b\u0435 \u0441\u043b\u043e\u0432\u0430 \u0438\u0437 STATES, NOUNS, PLACES, WHEN \u0438 \u0434\u0440\u0443\u0433\u0438\u0445 \u0441\u043f\u0438\u0441\u043a\u043e\u0432. \u0414\u0430\u043b\u0435\u0435 \u044d\u0442\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0441\u043b\u043e\u0432\u0430 \u0432 \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0448\u0430\u0431\u043b\u043e\u043d\u0430 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u043e\u0433\u043e \u043c\u0435\u0442\u043e\u0434\u0430 format(), \u0430 \u0437\u0430\u0442\u0435\u043c \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 \u044d\u0442\u043e \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u0412\u0441\u0435 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0445\u043e\u0436\u0435 \u043d\u0430 \u043a\u043d\u0438\u0433\u0443 \u0434\u043b\u044f \u0438\u0433\u0440\u044b \u0432 Mad Libs, \u043d\u043e \u043f\u0440\u043e\u0431\u0435\u043b\u044b \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440, \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0447\u0435\u043c\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043c\u043e\u0436\u0435\u0442 \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u044b\u0441\u044f\u0447\u0438 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432-\u043f\u0440\u0438\u043c\u0430\u043d\u043e\u043a \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0443.<\/p>\n<pre><code class=\"python\">1. \"\"\"\u0413\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432-\u043f\u0440\u0438\u043c\u0430\u043d\u043e\u043a, (c) \u042d\u043b \u0421\u0432\u0435\u0439\u0433\u0430\u0440\u0442 al@inventwithpython.com 2. \u0413\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432-\u043f\u0440\u0438\u043c\u0430\u043d\u043e\u043a \u0434\u043b\u044f \u0441\u0430\u0439\u0442\u0430 \u0441\u043e \u0441\u043a\u0443\u0447\u043d\u044b\u043c \u043a\u043e\u043d\u0442\u0435\u043d\u0442\u043e\u043c 3. \u041a\u043e\u0434 \u0440\u0430\u0437\u043c\u0435\u0449\u0435\u043d \u043d\u0430 https:\/\/nostarch.com\/big-book-small-python-projects 4. \u0422\u0435\u0433\u0438: \u0431\u043e\u043b\u044c\u0448\u0430\u044f, \u0434\u043b\u044f \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0438\u0445, \u044e\u043c\u043e\u0440, \u0441\u043b\u043e\u0432\u0430\"\"\" 5. 6. import random 7. 8. # \u0417\u0430\u0434\u0430\u0435\u043c \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b: 9. OBJECT_PRONOUNS = ['Her', 'Him', 'Them'] 10. POSSESIVE_PRONOUNS = ['Her', 'His', 'Their'] 11. PERSONAL_PRONOUNS = ['She', 'He', 'They'] 12. STATES = ['California', 'Texas', 'Florida', 'New York', 'Pennsylvania', 13.            'Illinois', 'Ohio', 'Georgia', 'North Carolina', 'Michigan'] 14. NOUNS = ['Athlete', 'Clown', 'Shovel', 'Paleo Diet', 'Doctor', 'Parent', 15.            'Cat', 'Dog', 'Chicken', 'Robot', 'Video Game', 'Avocado', 16.            'Plastic Straw','Serial Killer', 'Telephone Psychic'] 17. PLACES = ['House', 'Attic', 'Bank Deposit Box', 'School', 'Basement', 18.            'Workplace', 'Donut Shop', 'Apocalypse Bunker'] 19. WHEN = ['Soon', 'This Year', 'Later Today', 'RIGHT NOW', 'Next Week'] 20. 21. 22. def main(): 23.     print('Clickbait Headline Generator') 24.     print('By Al Sweigart al@inventwithpython.com') 25.     print() 26. 27.     print('Our website needs to trick people into looking at ads!') 28.     while True: 29.        print('Enter the number of clickbait headlines to generate:') 30.     response = input('> ') 31.     if not response.isdecimal(): 32.        print('Please enter a number.') 33.     else: 34.        numberOfHeadlines = int(response) 35.        break # \u0412\u044b\u0445\u043e\u0434\u0438\u043c \u0438\u0437 \u0446\u0438\u043a\u043b\u0430, \u043a\u043e\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u0432\u0435\u0434\u0435\u043d\u043e \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u043e\u0435 \u0447\u0438\u0441\u043b\u043e. 36. 37. for i in range(numberOfHeadlines): 38.      clickbaitType = random.randint(1, 8) 39. 40.      if clickbaitType == 1: 41.           headline = generateAreMillennialsKillingHeadline() 42.      elif clickbaitType == 2: 43.           headline = generateWhatYouDontKnowHeadline() 44.      elif clickbaitType == 3: 45.           headline = generateBigCompaniesHateHerHeadline() 46.      elif clickbaitType == 4: 47.           headline = generateYouWontBelieveHeadline() 48.      elif clickbaitType == 5: 49.           headline = generateDontWantYouToKnowHeadline() 50.      elif clickbaitType == 6: 51.           headline = generateGiftIdeaHeadline() 52.      elif clickbaitType == 7: 53.           headline = generateReasonsWhyHeadline() 54.      elif clickbaitType == 8: 55.           headline = generateJobAutomatedHeadline() 56. 57.       print(headline) 58.   print() 59. 60. website = random.choice(['wobsite', 'blag', 'Facebuuk', 'Googles', 61.                   'Facesbook', 'Tweedie', 'Pastagram']) 62. when = random.choice(WHEN).lower() 63. print('Post these to our', website, when, 'or you\\'re fired!') 64. 65. 66. # \u0412\u0441\u0435 \u044d\u0442\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0442 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0442\u0438\u043f\u043e\u0432: 67. def generateAreMillennialsKillingHeadline(): 68.      noun = random.choice(NOUNS) 69.      return 'Are Millennials Killing the {} Industry?'.format(noun) 70. 71. 72. def generateWhatYouDontKnowHeadline(): 73.      noun = random.choice(NOUNS) 74.      pluralNoun = random.choice(NOUNS) + 's' 75.      when = random.choice(WHEN) 76.      return 'Without This {}, {} Could Kill You {}'.format(noun, pluralNoun, 77.      when) 78. 79. def generateBigCompaniesHateHerHeadline(): 80.      pronoun = random.choice(OBJECT_PRONOUNS) 81.      state = random.choice(STATES) 82.      noun1 = random.choice(NOUNS) 83.      noun2 = random.choice(NOUNS) 84.      return 'Big Companies Hate {}! See How This {} {} Invented a Cheaper {}'.            format(pronoun, state, noun1, noun2) 85. 86. def generateYouWontBelieveHeadline(): 87.      state = random.choice(STATES) 88.      noun = random.choice(NOUNS) 89.      pronoun = random.choice(POSSESIVE_PRONOUNS) 90.      place = random.choice(PLACES) 91.      return 'You Won\\'t Believe What This {} {} Found in {} {}'.format(state, 92.      noun, pronoun, place) 93. 94. def generateDontWantYouToKnowHeadline(): 95.      pluralNoun1 = random.choice(NOUNS) + 's' 96.      pluralNoun2 = random.choice(NOUNS) + 's' 97.      return 'What {} Don\\'t Want You To Know About {}'.format(pluralNoun1, 98.      pluralNoun2) 99. 100. 101. def generateGiftIdeaHeadline(): 102.     number = random.randint(7, 15) 103.     noun = random.choice(NOUNS) 104.     state = random.choice(STATES) 105.     return '{} Gift Ideas to Give Your {} From {}'.format(number, noun, state) 106. 107. def generateReasonsWhyHeadline(): 108.     number1 = random.randint(3, 19) 109.     pluralNoun = random.choice(NOUNS) + 's' 110.     # number2 should be no larger than number1: 111.     number2 = random.randint(1, number1) 112.     return '{} Reasons Why {} Are More Interesting Than You Think (Number {} 113.     Will Surprise You!)'.format(number1, pluralNoun, number2) 114. 115. 116. def generateJobAutomatedHeadline(): 117.     state = random.choice(STATES) 118.     noun = random.choice(NOUNS) 119. 120.     i = random.randint(0, 2) 121.     pronoun1 = POSSESIVE_PRONOUNS[i] 122.     pronoun2 = PERSONAL_PRONOUNS[i] 123.     if pronoun1 == 'Their': 124.          return 'This {} {} Didn\\'t Think Robots Would Take {} Job. {} Were                 Wrong.'.format(state, noun, pronoun1, pronoun2) 125. else: 126. return 'This {} {} Didn\\'t Think Robots Would Take {} Job. {} Was Wrong.'.format(state, noun, pronoun1, pronoun2) 127. 128. 129. # \u0415\u0441\u043b\u0438 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0430 \u043d\u0435 \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f, \u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f, \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u043c \u0437\u0430\u043f\u0443\u0441\u043a: 130. if __name__ == '__main__': 131.     main()<\/code><\/pre>\n<p>  \u041a\u043e\u0433\u0434\u0430 \u0432\u044b \u0432\u0432\u0435\u0434\u0435\u0442\u0435 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u0435\u0433\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437, \u043f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u043f\u043e\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441 \u0432\u043d\u0435\u0441\u0435\u043d\u0438\u0435\u043c \u0432 \u043d\u0435\u0433\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0439. \u041c\u043e\u0436\u0435\u0442\u0435 \u0442\u0430\u043a\u0436\u0435 \u0441\u0430\u043c\u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u0442\u044c, \u043a\u0430\u043a \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0435:<\/p>\n<ul>\n<li>\u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0435\u0449\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0438\u043f\u043e\u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u043e\u0432-\u043f\u0440\u0438\u043c\u0430\u043d\u043e\u043a;<\/li>\n<\/ul>\n<ul>\n<li>\u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u043a\u0430\u0442\u0435\u0433\u043e\u0440\u0438\u0438 \u0441\u043b\u043e\u0432, \u043f\u043e\u043c\u0438\u043c\u043e NOUNS, STATES \u0438 \u0442. \u0434.<\/li>\n<\/ul>\n<p>  <\/p>\n<h3>\u0418\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b<\/h3>\n<p>  \u041f\u043e\u043f\u0440\u043e\u0431\u0443\u0439\u0442\u0435 \u043d\u0430\u0439\u0442\u0438 \u043e\u0442\u0432\u0435\u0442\u044b \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u044b. \u041f\u043e\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0439\u0442\u0435 \u0441 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f\u043c\u0438 \u043a\u043e\u0434\u0430 \u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0443 \u0441\u043d\u043e\u0432\u0430, \u0447\u0442\u043e\u0431\u044b \u0443\u0432\u0438\u0434\u0435\u0442\u044c, \u043a\u0430\u043a \u043e\u043d\u0438 \u043f\u043e\u0432\u043b\u0438\u044f\u044e\u0442 \u043d\u0430 \u0435\u0435 \u0440\u0430\u0431\u043e\u0442\u0443.<\/p>\n<p>  1. \u041a\u0430\u043a\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435 \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435, \u0435\u0441\u043b\u0438 \u0443\u0434\u0430\u043b\u0438\u0442\u0435 \u0438\u043b\u0438 \u0437\u0430\u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u0442\u0435 numberOfHeadlines = int(response) \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 34?<br \/>  2. \u041a\u0430\u043a\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435 \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435, \u0435\u0441\u043b\u0438 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u0435 int(response) \u043d\u0430 response \u0432 \u0441\u0442\u0440\u043e\u043a\u0435 34?<br \/>  3. \u041a\u0430\u043a\u043e\u0435 \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u043e\u0431 \u043e\u0448\u0438\u0431\u043a\u0435 \u0432\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0435, \u0435\u0441\u043b\u0438 \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u0435 \u0441\u0442\u0440\u043e\u043a\u0443 19 \u043d\u0430 WHEN = []?<\/p>\n<p>  \u0411\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u0441 \u043a\u043d\u0438\u0433\u043e\u0439 \u043c\u043e\u0436\u043d\u043e \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u043d\u0430 <a href=\"https:\/\/www.piter.com\/product\/bolshaya-kniga-proektov-python?_gs_cttl=120&amp;gs_direct_link=1&amp;gsaid=42817&amp;gsmid=29789&amp;gstid=c\">\u0441\u0430\u0439\u0442\u0435 \u0438\u0437\u0434\u0430\u0442\u0435\u043b\u044c\u0441\u0442\u0432\u0430<\/a><br \/>  \u00bb <a href=\"https:\/\/www.piter.com\/product\/bolshaya-kniga-proektov-python#Oglavlenie-1\">\u041e\u0433\u043b\u0430\u0432\u043b\u0435\u043d\u0438\u0435<\/a><br \/>  \u00bb <a href=\"https:\/\/www.piter.com\/product\/bolshaya-kniga-proektov-python#Otryvok-1\">\u041e\u0442\u0440\u044b\u0432\u043e\u043a<\/a><\/p>\n<p>  \u041f\u043e \u0444\u0430\u043a\u0442\u0443 \u043e\u043f\u043b\u0430\u0442\u044b \u0431\u0443\u043c\u0430\u0436\u043d\u043e\u0439 \u0432\u0435\u0440\u0441\u0438\u0438 \u043a\u043d\u0438\u0433\u0438 \u043d\u0430 e-mail \u0432\u044b\u0441\u044b\u043b\u0430\u0435\u0442\u0441\u044f \u044d\u043b\u0435\u043a\u0442\u0440\u043e\u043d\u043d\u0430\u044f \u043a\u043d\u0438\u0433\u0430.<\/p>\n<p>  \u0414\u043b\u044f \u0425\u0430\u0431\u0440\u043e\u0436\u0438\u0442\u0435\u043b\u0435\u0439 \u0441\u043a\u0438\u0434\u043a\u0430 25% \u043f\u043e \u043a\u0443\u043f\u043e\u043d\u0443 \u2014 <b>Python<\/b><\/div>\n<\/div>\n<\/div>\n<div class=\"v-portal\" style=\"display:none;\"><\/div>\n<\/div>\n<p> <!----> <!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/company\/piter\/blog\/598341\/\"> https:\/\/habr.com\/ru\/company\/piter\/blog\/598341\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><a href=\"https:\/\/habr.com\/ru\/company\/piter\/blog\/598341\/\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w780q1\/webt\/z7\/yi\/kx\/z7yikxxmn_aouxb1hm-bkwv-qqg.jpeg\" align=\"left\" alt=\"image\" data-src=\"https:\/\/habrastorage.org\/webt\/z7\/yi\/kx\/z7yikxxmn_aouxb1hm-bkwv-qqg.jpeg\" data-blurred=\"true\"\/><\/a> \u041f\u0440\u0438\u0432\u0435\u0442, \u0425\u0430\u0431\u0440\u043e\u0436\u0438\u0442\u0435\u043b\u0438! \u0412\u044b \u0443\u0436\u0435 \u043e\u0441\u0432\u043e\u0438\u043b\u0438 \u043e\u0441\u043d\u043e\u0432\u044b \u0441\u0438\u043d\u0442\u0430\u043a\u0441\u0438\u0441\u0430 Python \u0438 \u0433\u043e\u0442\u043e\u0432\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c? \u041e\u0442\u0442\u043e\u0447\u0438\u0442\u0435 \u0441\u0432\u043e\u0438 \u043d\u0430\u0432\u044b\u043a\u0438 \u043d\u0430 \u0441\u0430\u043c\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447\u0430\u0445 \u2014 \u0433\u0440\u0430\u0444\u0438\u043a\u0435, \u0438\u0433\u0440\u0430\u0445, \u0430\u043d\u0438\u043c\u0430\u0446\u0438\u0438, \u0440\u0430\u0441\u0447\u0435\u0442\u0430\u0445 \u0438 \u043c\u043d\u043e\u0433\u043e\u043c \u0434\u0440\u0443\u0433\u043e\u043c. \u0412\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u044f \u043a \u0433\u043e\u0442\u043e\u0432\u044b\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u043c \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0435 \u0434\u0435\u0442\u0430\u043b\u0438.\u0412 256 \u0441\u0442\u0440\u043e\u043a \u043a\u043e\u0434\u0430 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u0441\u044f \u0432\u0441\u0435 \u2014 \u00ab\u0432\u0438\u043d\u0442\u0430\u0436\u043d\u0430\u044f\u00bb \u044d\u043a\u0440\u0430\u043d\u043d\u0430\u044f \u0437\u0430\u0441\u0442\u0430\u0432\u043a\u0430, \u0437\u0430\u0431\u0435\u0433 \u0443\u043b\u0438\u0442\u043e\u043a \u043d\u0430 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c, \u0440\u0435\u043a\u043b\u0430\u043c\u043d\u044b\u0439 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043e\u043a-\u043f\u0440\u0438\u043c\u0430\u043d\u043a\u0430, \u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0430\u044f\u0441\u044f \u0441\u043f\u0438\u0440\u0430\u043b\u044c \u0414\u041d\u041a \u0438 \u0442\u0430\u043a \u0434\u0430\u043b\u0435\u0435. \u0414\u043e\u0431\u0430\u0432\u044c\u0442\u0435 \u043a \u044d\u0442\u043e\u043c\u0443 \u043f\u0430\u0440\u0443 \u0441\u0442\u0440\u043e\u043a \u0441\u0432\u043e\u0435\u0433\u043e \u043a\u043e\u0434\u0430, \u0438 \u0432\u044b \u0441\u043c\u043e\u0436\u0435\u0442\u0435 \u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u043c\u0438 \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u043c\u0438 \u0432 \u0438\u043d\u0442\u0435\u0440\u043d\u0435\u0442\u0435.<\/p>\n<p>  \u0427\u0422\u041e \u0412\u041d\u0423\u0422\u0420\u0418?<br \/>  \u2022 \u00ab\u0432\u0438\u0441\u0435\u043b\u0438\u0446\u0430\u00bb, \u0431\u043b\u0435\u043a-\u0434\u0436\u0435\u043a \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0438\u0433\u0440\u044b, \u0432 \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0436\u043d\u043e \u0438\u0433\u0440\u0430\u0442\u044c \u0441\u0430\u043c\u043e\u043c\u0443 \u0438\u043b\u0438 \u0441 \u0434\u0440\u0443\u0437\u044c\u044f\u043c\u0438;<br \/>  \u2022 \u0438\u043c\u0438\u0442\u0430\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u043c\u043e\u0434\u0435\u043b\u0438 \u043b\u0435\u0441\u043d\u044b\u0445 \u043f\u043e\u0436\u0430\u0440\u043e\u0432, \u0431\u0440\u043e\u0441\u043a\u043e\u0432 \u0438\u0433\u0440\u0430\u043b\u044c\u043d\u044b\u0445 \u043a\u043e\u0441\u0442\u0435\u0439 \u0438 \u044f\u043f\u043e\u043d\u0441\u043a\u0438\u0445 \u0441\u0447\u0435\u0442\u043e\u0432-\u0430\u0431\u0430\u043a\u0438;<br \/>  \u2022 \u0430\u043d\u0438\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0438\u0437\u043e\u0431\u0440\u0430\u0436\u0435\u043d\u0438\u044f \u0430\u043a\u0432\u0430\u0440\u0438\u0443\u043c\u0430, \u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0435\u0433\u043e\u0441\u044f \u043a\u0443\u0431\u0430 \u0438 \u043b\u043e\u0433\u043e\u0442\u0438\u043f\u0430 DVD, \u043e\u0442\u0441\u043a\u0430\u043a\u0438\u0432\u0430\u044e\u0449\u0435\u0433\u043e \u043e\u0442 \u043a\u0440\u0430\u0435\u0432 \u044d\u043a\u0440\u0430\u043d\u0430;<br \/>  \u2022 \u0442\u0440\u0435\u0445\u043c\u0435\u0440\u043d\u0430\u044f \u00ab\u0431\u0440\u043e\u0434\u0438\u043b\u043a\u0430\u00bb \u043f\u043e \u043b\u0430\u0431\u0438\u0440\u0438\u043d\u0442\u0443;<br \/>  \u2022 \u043a\u0440\u0438\u043f\u0442\u043e\u0433\u0440\u0430\u0444\u0438\u044f, \u0448\u0438\u0444\u0440\u044b \u0412\u0438\u0436\u0435\u043d\u0435\u0440\u0430 \u0438 ROT13, \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0435 \u043d\u0430\u0434\u0435\u0436\u043d\u043e \u0441\u043f\u0440\u044f\u0442\u0430\u0442\u044c \u0432\u0430\u0448 \u0442\u0435\u043a\u0441\u0442.  <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-329293","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/329293","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=329293"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/329293\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=329293"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=329293"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=329293"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}