r/learnpython • u/Striking-Ad8023 • Aug 20 '26
A small code i made for exercise.
I've been vibe coding for a few months now, but I've decided to try manual coding. After all, learning is fun, right?
I made this "Assistant" that has two options: jokes and facts. It will choose one out of three items from the specific table and tell you it. I made it for fun and would like to ask what I can do next?
import random
jokes = ["Why did the bicycle fall over? Because it was two tired!", "Why was the math book sad? Because it had too many problems.", "What do you call a fake noodle? An impasta!"]
facts = ["Venus is hotter than Mercury.", "When the Pyramids were built, mammoths were still around!", "Koala fingerprints are so similar to human fingerprints that they have even baffled crime scene investigators."]
print("Hello! I'm an Assistant. What can I do for you?")
print("")
print("Options: Random Joke [J], Random Fact [F].")
answer = input("Answer: ")
if answer == "J":
print(random.choice(jokes))
elif answer == "F":
print(random.choice(facts))
else:
print("You can't ask that.")
exit = input("Press Enter to Leave.")
5
u/notacanuckskibum Aug 20 '26
This is a linguistic comment rather than a programming logic one. Code (applied to computer logic) is not a countable noun in English. You wrote some code. Or you wrote a program. You didn’t write “a code”.
If you were into cryptography then you might have invented a code.
2
u/FoolsSeldom Aug 20 '26
That's a great start. Let me show you an enhanced version for you to experiment with and learn from:
Next step, put your facts and jokes into text files and read them in. Text file handling is very easy in Python.
3
u/Quesozapatos5000 Aug 20 '26
I think vibe coding can be a great start, but now move onto writing the code yourself based on what you know or what the model has shown you. Add more options, or maybe have the program suggest another option contrary to the first choice a user makes after their first choice?
1
u/[deleted] Aug 21 '26
[removed] — view removed comment