forked from keshavsingh4522/hacktoberfest
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
keshavsingh4522#4538 feat created random jokes generator by python
- Loading branch information
1 parent
2d33cda
commit ade87e9
Showing
1 changed file
with
111 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
feat #4538 | ||
|
||
|
||
import random | ||
|
||
# Define a list of jokes | ||
jokes = [ | ||
"Why did the scarecrow win an award? Because he was outstanding in his field!", | ||
"What do you call a fish with no eyes? Fsh!", | ||
"Parallel lines have so much in common. It’s a shame they’ll never meet.", | ||
"Why don't scientists trust atoms? Because they make up everything!", | ||
"I told my wife she was drawing her eyebrows too high. She looked surprised.", | ||
"Why couldn't the bicycle stand up by itself? It was two-tired.", | ||
"Did you hear about the mathematician who's afraid of negative numbers? He'll stop at nothing to avoid them.", | ||
"I'm reading a book on anti-gravity. It's impossible to put down!", | ||
"Parallel lines have so much in common. It’s a shame they’ll never meet.", | ||
"I used to play piano by ear, but now I use my hands.", | ||
"I'm on a whiskey diet. I've lost three days already.", | ||
"I'm friends with all electricians. We have such good current connections.", | ||
"Why don't skeletons fight each other? They don't have the guts.", | ||
"I'm reading a book on anti-gravity. It's impossible to put down!", | ||
"I told my wife she was drawing her eyebrows too high. She looked surprised.", | ||
"Why did the math book look sad? Because it had too many problems.", | ||
"How do you organize a space party? You "planet!"", | ||
"I'd tell you a construction joke, but I'm still working on it.", | ||
"I'm friends with all electricians. We have such good current connections.", | ||
"Why don't skeletons fight each other? They don't have the guts.", | ||
"I'm reading a book on anti-gravity. It's impossible to put down!", | ||
"I told my wife she was drawing her eyebrows too high. She looked surprised.", | ||
"Why did the math book look sad? Because it had too many problems.", | ||
"How do you organize a space party? You "planet!"", | ||
"I'd tell you a construction joke, but I'm still working on it.", | ||
"Parallel lines have so much in common. It’s a shame they’ll never meet.", | ||
"I used to play piano by ear, but now I use my hands.", | ||
"I'm on a whiskey diet. I've lost three days already.", | ||
"I'm friends with all electricians. We have such good current connections.", | ||
"Why don't skeletons fight each other? They don't have the guts.", | ||
"I'm reading a book on anti-gravity. It's impossible to put down!", | ||
"I told my wife she was drawing her eyebrows too high. She looked surprised.", | ||
"Why did the math book look sad? Because it had too many problems.", | ||
"How do you organize a space party? You "planet!"", | ||
"I'd tell you a construction joke, but I'm still working on it.", | ||
"What do you call a bear with no teeth? A gummy bear.", | ||
"I'm friends with all electricians. We have such good current connections.", | ||
"Why don't skeletons fight each other? They don't have the guts.", | ||
"I'm reading a book on anti-gravity. It's impossible to put down!", | ||
"I told my wife she was drawing her eyebrows too high. She looked surprised.", | ||
"Why did the math book look sad? Because it had too many problems.", | ||
"How do you organize a space party? You "planet!"", | ||
"I'd tell you a construction joke, but I'm still working on it.", | ||
"What do you call a bear with no teeth? A gummy bear.", | ||
"I'm friends with all electricians. We have such good current connections.", | ||
"Why don't skeletons fight each other? They don't have the guts.", | ||
"I'm reading a book on anti-gravity. It's impossible to put down!", | ||
"I told my wife she was drawing her eyebrows too high. She looked surprised.", | ||
"Why did the math book look sad? Because it had too many problems.", | ||
"How do you organize a space party? You "planet!"", | ||
"I'd tell you a construction joke, but I'm still working on it.", | ||
"What do you call a bear with no teeth? A gummy bear.", | ||
"I'm friends with all electricians. We have such good current connections.", | ||
"Why don't skeletons fight each other? They don't have the guts.", | ||
"I'm reading a book on anti-gravity. It's impossible to put down!", | ||
"I told my wife she was drawing her eyebrows too high. She looked surprised.", | ||
"Why did the math book look sad? Because it had too many problems.", | ||
"How do you organize a space party? You "planet!"", | ||
"I'd tell you a construction joke, but I'm still working on it.", | ||
"What do you call a bear with no teeth? A gummy bear.", | ||
"I'm friends with all electricians. We have such good current connections.", | ||
"Why don't skeletons fight each other? They don't have the guts.", | ||
"I'm reading a book on anti-gravity. It's impossible to put down!", | ||
"I told my wife she was drawing her eyebrows too high. She looked surprised.", | ||
"Why did the math book look sad? Because it had too many problems.", | ||
"How do you organize a space party? You "planet!"", | ||
"I'd tell you a construction joke, but I'm still working on it.", | ||
"What do you call a bear with no teeth? A gummy bear.", | ||
"I'm friends with all electricians. We have such good current connections.", | ||
"Why don't skeletons fight each other? They don't have the guts.", | ||
"I'm reading a book on anti-gravity. It's impossible to put down!", | ||
"I told my wife she was drawing her eyebrows too high. She looked surprised.", | ||
"Why did the math book look sad? Because it had too many problems.", | ||
"How do you organize a space party? You "planet!"", | ||
"I'd tell you a construction joke, but I'm still working on it.", | ||
"What do you call a bear with no teeth? A gummy bear." | ||
] | ||
|
||
# Initialize a list to keep track of used jokes | ||
used_jokes = [] | ||
|
||
def get_random_unique_joke(): | ||
"""Return a random joke that hasn't been used yet.""" | ||
if len(used_jokes) == len(jokes): | ||
# Reset used jokes if all jokes have been used once | ||
used_jokes.clear() | ||
|
||
# Choose a random joke that hasn't been used yet | ||
joke = random.choice(jokes) | ||
while joke in used_jokes: | ||
joke = random.choice(jokes) | ||
|
||
used_jokes.append(joke) | ||
return joke | ||
|
||
if __name__ == "__main__": | ||
input("Press Enter for a random joke... (Press Ctrl+C to exit)") | ||
|
||
try: | ||
while True: | ||
joke = get_random_unique_joke() | ||
print(joke) | ||
input("Press Enter for another joke...") | ||
except KeyboardInterrupt: |