MCPcopy Create free account
hub / github.com/asweigart/PythonStdioGames / main

Function main

src/gamesbyexample/clickbait.py:22–63  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

20
21
22def 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 # Exit the loop once a valid number is entered.
36
37 for i in range(numberOfHeadlines):
38 clickbaitType = random.randint(1, 8)
39
40 if clickbaitType == 1:
41 headline = generateAreMillenialsKillingHeadline()
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# Each of these functions returns a different type of headline:

Callers 1

clickbait.pyFile · 0.70

Tested by

no test coverage detected