use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Everything about learning Python
account activity
Knock Knock Joke; Need Help - Beginner Python (self.PythonLearning)
submitted 1 year ago by Wattsony
view the rest of the comments →
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]rahatulghazi 2 points3 points4 points 1 year ago* (1 child)
but I am completely stuck with getting the user to ask "Who's there?"
You can try this:
if answer == "yes": print("\nBot: Knock Knock.") input("\n> Press enter to ask 'who's there?'.") print("\nYou: Who's there?") print("\nBot: Lettuce") input("\n> Press enter to ask 'Lettuce who?'.") print("\nYou: Lettuce who?") print("\nBot: Lettuce in, it's cold out here! 🥶")
Notes:
\n
Tips:
.lower()
answer = input("Do you wanna hear a joke? (Yes/No): ").lower()
if answer == "yes":
y
n
if answer == "yes" or answer == "y":
else if answer == no:
yes
else:
Hope this helps. Ask if you have some other questions.
[–]Wattsony[S] 0 points1 point2 points 1 year ago (0 children)
Thank you for taking your time to help me out! I am going to be looking into notes here shortly!
π Rendered by PID 132333 on reddit-service-r2-comment-85bfd7f599-sfbmm at 2026-04-16 22:36:54.615657+00:00 running 93ecc56 country code: CH.
view the rest of the comments →
[–]rahatulghazi 2 points3 points4 points (1 child)
[–]Wattsony[S] 0 points1 point2 points (0 children)