{"id":53203,"date":"2022-12-05T08:00:00","date_gmt":"2022-12-05T14:00:00","guid":{"rendered":"https:\/\/www.codewizardshq.com\/?p=53203"},"modified":"2025-08-29T03:28:45","modified_gmt":"2025-08-29T09:28:45","slug":"python-tutorial-dad-joke-app","status":"publish","type":"post","link":"https:\/\/www.codewizardshq.com\/python-tutorial-dad-joke-app\/","title":{"rendered":"Python Tutorial for Kids: Random Dad Joke App"},"content":{"rendered":"\n<p>Whether you love them or hate them, dads always have them at the ready. It\u2019s the classic dad joke.&nbsp;<\/p>\n\n\n\n<p><strong>We\u2019ve turned dad\u2019s favorite jokes into a Python app, so anyone can tell a great dad joke at any time. <\/strong>The Random Dad Joke App picks an awesome dad joke from a database and shows it to you so you can deliver the punchline. These jokes are so bad and corny, they might actually make you laugh!&nbsp;<\/p>\n\n\n<p style=\"background: none repeat scroll 0 0 #ecf3f6; clear: both; margin-bottom: 18px; overflow: hidden; border: 1px solid #011e41; padding: 16px;\"><span>\ud83d\udccc<\/span><small><strong> [Download] Free Python Lesson Plans<\/strong> Get free 1-week Python lesson plans and slides for kids ages 11-13 to start learning about Python coding. <a href=\"#lesson-plans\">Download Now<\/a><\/small><\/p>\n\n\n\n<h3 class=\"wp-block-heading\"><strong>Complete this Python coding tutorial to build your own Random Dad Joke App.<\/strong><\/h3>\n\n\n\n<p>Make your friends and family laugh with a few funny dad jokes.<\/p>\n\n\n\n<p><strong>See the completed <a href=\"https:\/\/projects.codewizardshq.com\/x_hour_of_code_2022\/python-projects\/random-dad-jokes\/main.py\" target=\"_blank\" rel=\"noreferrer noopener\">Random Dad Joke App<\/a><\/strong>.<\/p>\n\n\n\n<p><\/p>\n\n\n<div class=\"lazyblock-cw1-wide-post-container-ZdW3ax wp-block-lazyblock-cw1-wide-post-container\"><div class=\"wide \"><div class=\"lazyblock-inner-blocks\">\n\n<div class=\"wp-block-atomic-blocks-ab-container table-of-contents ab-block-container\"><div class=\"ab-container-inside\"><div class=\"ab-container-content\">\n<p class=\"has-text-align-left title\"><strong>Tutorial Steps<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"#step1\">Step 1: Display a welcome message to the user<\/a><\/li>\n\n\n\n<li><a href=\"#step2\">Step 2: Display the options the app accepts<\/a><\/li>\n\n\n\n<li><a href=\"#step3\">Step 3: Process the user&#8217;s choice<\/a><\/li>\n\n\n\n<li><a href=\"#step4\">Step 4: Get a random dad joke from the Dad Jokes API<\/a><\/li>\n\n\n\n<li><a href=\"#step5\">Step 5: Correctly format the data from the Dad Jokes API<\/a><\/li>\n\n\n\n<li><a href=\"#step6\">Step 6: Return the setup and punchline from the get_random_joke() function<\/a><\/li>\n\n\n\n<li><a href=\"#step7\">Step 7: Ask the user to guess the punchline and tell them if they&#8217;re right or wrong<\/a><\/li>\n\n\n\n<li><a href=\"#complete\">Finished project!<\/a><\/li>\n<\/ul>\n<\/div><\/div><\/div>\n\n<\/div><\/div><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"h-what-you-need\">What you need:<\/h2>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-1-text-editor\">1. Text editor<\/h3>\n\n\n\n<p><strong>We\u2019ll be using the CodeWizardsHQ editor to write and run our Python code. <\/strong>If you\u2019re a CodeWizardsHQ student, download the x_hour_of_code_2022 project for the completed code.&nbsp;<\/p>\n\n\n\n<p>You can also use an online text editor like <a href=\"https:\/\/replit.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">replit<\/a> that allows you to author and run Python programs in a web browser.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-2-an-empty-python-file\">2. An empty Python file<\/h3>\n\n\n\n<p><strong>Create a new empty Python file and add your code there.<\/strong>&nbsp;<\/p>\n\n\n\n<p>Our file is named main.py, and if you&#8217;re a CWHQ student you must use this name. If you&#8217;re using another platform to write and execute your code, you can choose whichever name you like.<\/p>\n\n\n\n<div style=\"height:20px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h3 class=\"wp-block-heading\">This tutorial is for beginner Python programmers ages 11+. Let&#8217;s get started!<\/h3>\n\n\n\n<div style=\"height:40px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"step1\">Step 1: Display a welcome message to the user<\/h2>\n\n\n\n<p>Display a message to the users that explains how the Random Dad Joke app works. <\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Create a variable called <code>welcome_message<\/code> that equals a multi-line string.<\/strong> This string contains your welcome message and instructions.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><mark>welcome_message = \"\"\"\n    Welcome to the 'Random Dad Joke' app!\n\n    This app uses an API to fetch a random setup\n    and punchline to a dad joke. The setup will\n    be displayed to you, and if you guess the punchline,\n    a message like \"That's correct!\" will be displayed.\n    Otherwise, you'll be shown the punchline.\n\"\"\"<\/mark><\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Use the <code>print()<\/code> function to display this message on the page. <\/strong>Note, the <code>...<\/code> symbols are just there to make the code easier to read. Don&#8217;t type that!<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>welcome_message = \"\"\"\n  ...\n\"\"\"\n\n<mark>print(welcome_message)<\/mark><\/code><\/pre>\n\n\n\n<p style=\"background: none repeat scroll 0 0 #ececec; clear: both; margin-bottom: 18px; overflow: hidden; border: 1px solid #eeeeee; padding: 13px;\"><strong><i> Hint:<\/i><\/strong><i> Change the message inside the &#8220;&#8221;&#8221; to personalize your welcome message.<\/i><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">Step 1 Output:<\/h3>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/sPbESH-BjOOBmpaN7I4aHgB00QuxgNZfceyxa496X-kDybDclihI0UfWwDQLVbPwBjIlyxLOn943En4t5EOPuv_QR5r5NAFJR_Q0gSaLVsPG5HLoefiO2YH4W2ko6bIwS6Q29X_LOIkcLhlxNOLtw_LURJbL6NJ_0qayawfEtuVw7SIkCBgZNO38NS56iw\" alt=\"python tutorial step 1\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"step2\">Step 2: Display the options the app accepts<\/h2>\n\n\n\n<p>Show the user the possible options the app accepts and prompt them for their choice.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Create a Python string representing the options for your user: 1) get a dad joke or 2) exit<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>welcome_message = \"\"\"\n  ...\n\"\"\"\n\n<mark>options = \"(1) Get Dad Joke (2) Exit: \"<\/mark>\n\nprint(welcome_message)<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Add a <code>while <\/code>loop that shows the user the options.<\/strong><\/li>\n\n\n\n<li><strong>Convert the user&#8217;s response to an int (integer) data type so we can easily process their choice. <\/strong>It&#8217;s much easier to compare integers versus string values that may have spaces, different casing, etc.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>print(welcome_message)\n<mark>\nwhile True:\n    user_choice = int(input(options))<\/mark><\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Add a <code>break <\/code>statement to exit the loop after the options are displayed.<\/strong> This stops the options from being continuously presented.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>while True:\n&nbsp; &nbsp; user_choice = int(input(options))\n&nbsp; &nbsp; <mark>break<\/mark><\/code><\/pre>\n\n\n\n<p style=\"background: none repeat scroll 0 0 #ececec; clear: both; margin-bottom: 18px; overflow: hidden; border: 1px solid #eeeeee; padding: 13px;\"><strong><i> Hint:<\/i><\/strong><i> Create more options as an additional challenge.<\/i><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-step-2-output\">Step 2 Output:<\/h3>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh6.googleusercontent.com\/baYiKti6vMhuyZn5pfy1Q5DJVcBVQdG0_uJwN5OAY2Cn07QLrLmRKJqwgwn071Tzf0CnNrqoUFP6mecmJxaFWTef9g1Bx96DyYnUUZNXYs1bUE-Nt0F05cV624Kg_fsVLRKbcrNZfyhJI9iK6xiT506h8HcRxI3D7Vg1wCsBlA9exURGRHDw9FuvkK-B2g\" alt=\"python tutorial step 2\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"step3\">Step 3: Process the user&#8217;s choice<\/h2>\n\n\n\n<p>Next, we want the users to choose an option by entering the number 1 or 2 and we will execute their choice.&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Create named constants for each option: GET_JOKE if they select 1 and EXIT if they select 2<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>\n<mark>options = \"(1) Get Dad Joke (2) Exit: \"\n\nGET_JOKE = 1\nEXIT = 2\n<\/mark>\nprint(welcome_message)\n\nwhile True:\n&nbsp; &nbsp; ...<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Now we can add logic for each choice and remove the <code>break <\/code>statement from the <code>while<\/code> loop.<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>while True:\n&nbsp; &nbsp; user_choice = int(input(options))\n&nbsp; &nbsp; <mark><s>break&nbsp;<\/s> # Remove this!<\/mark><\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Add an <code>if...elif<\/code> conditional statement to handle both user options.&nbsp;<\/strong><\/li>\n\n\n\n<li><strong>If the user selects 1,<\/strong> we\u2019ll want to show a joke. For now, use the pass statement in the <code>GET_JOKE<\/code> condition. We\u2019ll implement the logic for that statement at a later time.&nbsp;<\/li>\n\n\n\n<li><strong>If the user selects 2,<\/strong> they exit the game. Make sure the <code>EXIT<\/code> option exits the loop with the <code>break <\/code>statement!&nbsp;<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>while True:\n&nbsp; &nbsp; user_choice = int(input(options))\n<mark>\n&nbsp; &nbsp; if user_choice == GET_JOKE:\n&nbsp; &nbsp; &nbsp; &nbsp; pass\n&nbsp; &nbsp; elif user_choice == EXIT:\n&nbsp; &nbsp; &nbsp; &nbsp; break\n<\/mark><\/code><\/pre>\n\n\n\n<p style=\"background: none repeat scroll 0 0 #ececec; clear: both; margin-bottom: 18px; overflow: hidden; border: 1px solid #eeeeee; padding: 13px;\"><strong><i> Hint: Create more options as an additional challenge.<\/i><\/strong><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-step-3-output\">Step 3 Output:<\/h3>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh6.googleusercontent.com\/6L0MmJUJdH_dm3EsLqppSGFxcYhSsNPQK5xKwAzwsavivBt1RnB3lnSCYvms7YOc_9TaGhxg9Mnze--mlTmOfsTH9uuAGXwpgR86zJeehCMjls6lfPP3IBvSeVszxlF6Bp7YKgKJDe2UEgyn6Ldft5Q5SJrpFpC_nqrW8GkCHBod_Bo1Tl8lYPebVJEhRg\" alt=\"python tutorial step 3\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"step4\">Step 4: Get a random dad joke from the Dad Jokes API<\/h2>\n\n\n\n<p>Now, let\u2019s get retrieve some hilarious dad jokes! We will be connecting to a CodeWizardsHQ API that holds a database of jokes.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Define a function called <code>get_random_joke()<\/code>. <\/strong>Function definitions go at the top of your file, before any variable declarations or other statements in the main area of your program.<\/li>\n\n\n\n<li><strong>Inside the function, create three variables: <code>BASE_URL<\/code>, <code>endpoint<\/code>, and <code>request_url<\/code> using the values listed below.<\/strong> The <code>BASE_URL<\/code> represents the location on the internet where the API lives. The <code>endpoint <\/code>is a special URL path that the API provides to get a random joke. The <code>request_url<\/code> combines the <code>BASE_URL<\/code> and <code>endpoint <\/code>into a single str representing the full URL that we&#8217;ll request data from.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><mark>def get_random_joke():\n&nbsp; &nbsp; BASE_URL = \"<\/mark>https:\/\/dad-joke-api.apps.codewizardshq.com<mark>\"\n&nbsp; &nbsp; endpoint = \"\/random\/jokes\"\n\n&nbsp; &nbsp; request_url = f\"{BASE_URL}{endpoint}\"\n<\/mark>\nwelcome_message = \"\"\"\n&nbsp; &nbsp; ...\n\"\"\"<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Use from to import the <code>urlopen()<\/code> function from the <code>urllib.request<\/code> module.<\/strong> This is a built-in Python module for making requests over a network. Import statements always come first, at the very top of your file.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><mark>from urllib.request import urlopen<\/mark>\n\n\ndef get_random_joke():\n    ...<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Use a with statement and the <code>urlopen()<\/code> function to make a request to the Dad Jokes API (at the <code>request_url<\/code>) and save the API&#8217;s response in a response variable.<\/strong> The with statement is a context manager, and it allows us to safely deal with opening and closing a network request.&nbsp;<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>from urllib.request import urlopen\n\n\ndef get_random_joke():\n&nbsp; &nbsp; BASE_URL = \"https:\/\/dad-joke-api.apps.codewizardshq.com\"\n&nbsp; &nbsp; endpoint = \"\/random\/jokes\"\n\n&nbsp; &nbsp; request_url = f\"{BASE_URL}{endpoint}\"\n<mark>\n&nbsp; &nbsp; with urlopen(request_url) as response:\n&nbsp; &nbsp; &nbsp; &nbsp; joke = response.read()<\/mark><\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>After the <code>with <\/code>statement, display the contents of the joke variable with the <code>print <\/code>function.<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>def get_random_joke():\n&nbsp; &nbsp; ...\n&nbsp; &nbsp; with urlopen(request_url) as response:\n&nbsp; &nbsp; &nbsp; &nbsp; joke = response.read()\n\n&nbsp; &nbsp; <mark>print(joke)<\/mark><\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Going back to the <code>while <\/code>loop, call the <code>get_random_joke()<\/code> function when the user chooses <code>GET_JOKE<\/code>.<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>while True:\n    user_choice = int(input(options))\n\n    if user_choice == GET_JOKE:\n        <mark>get_random_joke()<\/mark>\n    elif user_choice == EXIT:\n        break<\/code><\/pre>\n\n\n\n<p style=\"background: none repeat scroll 0 0 #ececec; clear: both; margin-bottom: 18px; overflow: hidden; border: 1px solid #eeeeee; padding: 13px;\"><strong><i>Hint:<\/i><\/strong><i> If you see a really long response when trying to get a dad joke, wait about 10 seconds and then try again. The API has to &#8220;wake up&#8221; from being asleep if it hasn&#8217;t been used recently!<\/i><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-step-4-output\">Step 4 Output:<\/h3>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/89_3VBtT_JWXT1Qkvm9h0v17y7w8FfkLjYzMl9PiMeeffiFnJ_K7LGt_FVbM_Z4h63fhcEhhIlxb6IKpMmcNqXBQzFglFfdslNVvXRVWk54xBFeEWCCths93ztHH1GfNmDIutfW7OP0WQAjqXIg8Egf9myL0Ap1lCuBchLqyyUz7Xe9K8y8Cw8UhV0TElg\" alt=\"python tutorial step 4\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"step5\">Step 5: Correctly format the data from the Dad Jokes API<\/h2>\n\n\n\n<p>Now we have the information (the joke) from the API, we need to format it in a way users can read it.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>At the top of your file, import the <code>loads()<\/code> function from Python&#8217;s built-in JSON module.<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>from urllib.request import urlopen\n<mark>from json import loads<\/mark>\n\n\ndef get_random_joke():\n    ...<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>In the <code>get_random_joke()<\/code> function, use the <code>loads()<\/code> function to ensure the response is converted to a dict.<\/strong> The dict data structure maps keys to values and will make it easy to get the setup and punchline from the API response.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>def get_random_joke():\n    ...\n<mark>\n    with urlopen(request_url) as response:\n        joke = loads(response.read())\n<\/mark>\n    print(joke)<\/code><\/pre>\n\n\n\n<p style=\"background: none repeat scroll 0 0 #ececec; clear: both; margin-bottom: 18px; overflow: hidden; border: 1px solid #eeeeee; padding: 13px;\"><strong><i>Hint:<\/i><\/strong><i> An API is an application programming interface which allows interactions between multiple software programs. Programmers (you!) then have access to data and info from external software (CodeWizardsHQ&#8217;s dad joke database).<\/i><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-step-5-output\">Step 5 Output:<\/h3>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/FVGHAnVPxUQ1_xyZw1GevDZB_7bOOH1S_5bSD9DqrULnohn09AKgb7ac-ftzR9MN2lAZki7h1cF8fDY5s4XB0aagF9z2_OSwh2Ej9zEP8ZhocHBjZ_4Nyl66Ck0vDR-HxAnqvzfjGB7dDjchTx-6NUOs7-ksuHMfqNP-KmctFiSB7qimxKrszynVkCaZmA\" alt=\"python tutorial step 5\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"step6\">Step 6: Return the setup and punchline from the get_random_joke() function<\/h2>\n\n\n\n<p>Now, let\u2019s separate the setup and the punchline as we will want to present them independently later.&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Remove the <code>print()<\/code> statement from the <code>get_random_joke()<\/code> function.&nbsp;<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>def get_random_joke():\n    ...\n    with urlopen(request_url) as response:\n        joke = loads(response.read())\n\n    <mark><s>print(joke)<\/s> # Remove this!<\/mark><\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Use the <code>return <\/code>statement to send the setup and punchline out of the function.<\/strong> Separating return values with a comma (<code>,<\/code>) allows you to send multiple values out of a function easily. The <code>[] <\/code>allow you to pull the values from the dict based on a key (the &#8220;setup&#8221; and &#8220;punchline&#8221; strings are the keys).<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>def get_random_joke():\n    ...\n    with urlopen(request_url) as response:\n        joke = loads(response.read())\n\n    <mark>return joke&#91;\"setup\"], joke&#91;\"punchline\"]<\/mark><\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>In the <code>while <\/code>loop, create the <code>setup <\/code>and <code>punchline <\/code>variables. <\/strong>You can use multiple assignment to store both the setup and punchline returned from <code>get_random_joke()<\/code>.<strong> <\/strong>Whenever a function returns multiple values, you can use this syntax to assign the values to variables in one line. You just need to make sure to have variables for every value and place them in the same order that the values are returned from the function.<\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code><mark>while True:\n    user_choice = int(input(options))\n\n    if user_choice == GET_JOKE:\n        setup, punchline = get_random_joke()\n    elif user_choice == EXIT:\n        break<mark><\/mark><\/mark><\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Use <code>f-strings<\/code> and the special <code>f\"{variable_name=}\"<\/code> syntax to ensure each variable represents the values you expect.<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>while True:\n    user_choice = int(input(options))\n\n    if user_choice == GET_JOKE:\n        setup, punchline = get_random_joke()<mark>\n        print(f\"{setup=}\")\n        print(f\"{punchline=}\")<\/mark>\n    elif user_choice == EXIT:\n        break<\/code><\/pre>\n\n\n\n<p style=\"background: none repeat scroll 0 0 #ececec; clear: both; margin-bottom: 18px; overflow: hidden; border: 1px solid #eeeeee; padding: 13px;\"><strong><i>Hint:<\/i><\/strong><i> An f-string is a formatted string literal. It lets you include the value of a variable inside a string with the prefix &#8220;f&#8221;.<\/i><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-step-6-output\">Step 6 Output:<\/h3>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/CJrP3_vUSp17oGuy1Wnm3tV8Nsedmy-GN_TWFl2wxTEsRgVQVdhVfTW1mhdXgCjBtZVpANbjUi3CFJvEpr3eGI42qXH9i8Qc8hT3KXHsJ7BsOpa33ZSr49I6o-fDolxFPOxg5q5fbBjNMvTwWWPiJQy7Z3oKscCSeu9ZCaVgf-iYCchgZvXwQqRgcuSrVg\" alt=\"python tutorial step 6\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"step7\">Step 7: Ask the user to guess the punchline and tell them if they&#8217;re right or wrong<\/h2>\n\n\n\n<p>After the user selects 2, we will prompt them to guess the punchline and also check if they guessed correctly.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>In the <code>while <\/code>loop, remove the <code>f-strings<\/code> that displayed the setup and punchline with the <code>f\"{variable_name=}\"<\/code> syntax.<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>while True:\n    user_choice = int(input(options))\n\n    if user_choice == GET_JOKE:\n        setup, punchline = get_random_joke()\n<mark>\n        <s>print(f\"{setup=}\")<\/s>      # Remove this!\n        <s>print(f\"{punchline=}\")<\/s>  # Remove this!\n<\/mark>\n    elif user_choice == EXIT:\n        break<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Use <code>print() <\/code>to display the setup and prompt the user to guess the punchline.<\/strong> <\/li>\n\n\n\n<li><strong>Create a variable called <code>user_guess<\/code> that stores the user&#8217;s response.<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>while True:\n&nbsp; &nbsp; user_choice = int(input(options))\n\n&nbsp; &nbsp; if user_choice == GET_JOKE:\n&nbsp; &nbsp; &nbsp; &nbsp; setup, punchline = get_random_joke()\n&nbsp; &nbsp; &nbsp; &nbsp; <mark>print(setup)<\/mark>\n\n&nbsp; &nbsp; &nbsp; &nbsp; <mark>user_guess = input(\"Guess the punchline: \")<\/mark>\n&nbsp; &nbsp; elif user_choice == EXIT:\n&nbsp; &nbsp; &nbsp; &nbsp; break<\/code><\/pre>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Using an<code> if...else<\/code> conditional statement, display a message like &#8220;That&#8217;s correct!&#8221; if the user guessed the punchline correctly. Otherwise, display a message like &#8220;Sorry, that wasn&#8217;t the punchline.&#8221; and then display the punchline.<\/strong><\/li>\n<\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code>while True:\n    user_choice = int(input(options))\n\n    if user_choice == GET_JOKE:\n        setup, punchline = get_random_joke()\n        print(setup)\n\n        user_guess = input(\"Guess the punchline: \")\n<mark>\n        if user_guess == punchline:\n            print(\"That's correct!\")\n        else:\n            print(\"Sorry, that wasn't the punchline.\")\n            print(f\"The punchline was: {punchline}\")\n<\/mark>\n    elif user_choice == EXIT:\n        break<\/code><\/pre>\n\n\n\n<p style=\"background: none repeat scroll 0 0 #ececec; clear: both; margin-bottom: 18px; overflow: hidden; border: 1px solid #eeeeee; padding: 13px;\"><strong><i>Hint:<\/i><\/strong><i> Change the text inside the print() function to customize your user message.<\/i><\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"h-step-7-output\">Step 7 Output:<\/h3>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh3.googleusercontent.com\/tO2kQ9EY0UcwAqRKkO7jwStUFo9ztKQXxvZSIJ1FWs09pd2kkh2h9mGbhDAS6V7o0ELYuhfYuaaD-n30fndOeejoIOiTg3lgGYV6TcPk7X1znFfBnatMykexKGfmTl2JdMEpiT8el-FODHfitLBD1gFqRg5lhOPhCay29BUsO8q4Ls2aNNtv3ghWioLjSg\" alt=\"python tutorial step 7\"\/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"complete\">Your app is complete!<\/h2>\n\n\n\n<p>Check out the finished <a href=\"https:\/\/projects.codewizardshq.com\/x_hour_of_code_2022\/python-projects\/random-dad-jokes\/main.py\">Random Dad Joke App<\/a>.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"https:\/\/lh4.googleusercontent.com\/-lmb1KAahMrKQ1mC8BjlRJO9JlvJ1vOQ3OvdhnQtYuItWAm2CcCyBvI6QOSEgFbIcpc0M2jFzyZ26_0YT3gli6WKXk4FrB0reTwWvLgvUYqCP7CvuCrnY7y1TYiqLfqvE-TQgK29n2lgF8uswWnCWcvPCUAQkIB4hhCIKih7FNhKY-hYC3uoE02fZkAFVQ\" alt=\"python tutorial dad jokes complete\"\/><\/figure>\n\n\n\n<p><strong>Download the <\/strong><a href=\"https:\/\/drive.google.com\/drive\/folders\/1y52h6PsQ1M3HMb5oM8qbBwFChBkptITJ?usp=sharing\" target=\"_blank\" rel=\"noreferrer noopener\"><strong>project files<\/strong><\/a><strong> and open main.py to view the completed project.<\/strong> <\/p>\n\n\n\n<p>Now, you\u2019re ready with a great dad joke in every situation.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"lesson-plans\"><strong>Download 1-Week Python Lesson Plans<\/strong><\/h2>\n\n\n\n<p>Kds ages 11-13 can start learning Python in a structured way. Download a FREE 1-week lesson plan with activities and slides. Enter your name and email to receive the free lesson plans in your inbox today.<\/p>\n\n\n<!-- This site is converting visitors into subscribers and customers with OptinMonster - https:\/\/optinmonster.com :: Campaign Title: Python Lesson Plans with Location [Download] -->\n<div id=\"om-cvhl80abvbnee4dvgs0y-holder\"><\/div>\n<script>(function(d,u,ac){var s=d.createElement('script');s.type='text\/javascript';s.src='https:\/\/a.omappapi.com\/app\/js\/api.min.js';s.async=true;s.dataset.user=u;s.dataset.campaign=ac;d.getElementsByTagName('head')[0].appendChild(s);})(document,16320,'cvhl80abvbnee4dvgs0y');<\/script>\n<!-- \/ OptinMonster -->\n\n\n<div style=\"height:40px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p><strong>If you want to build games and apps in Python, join CodeWizardsHQ\u2019s live <a href=\"\/\">coding classes for kids<\/a>.<\/strong> It\u2019s the most fun and effective way for kids to learn Python and advance to a real-world coding internship.&nbsp;<\/p>\n\n\n\n<p><strong>Students in our <a href=\"https:\/\/www.codewizardshq.com\/coding-classes-middle-school-students\/\">middle school<\/a> and <a href=\"https:\/\/www.codewizardshq.com\/coding-classes-high-school-students\/\">high school<\/a> core track start by learning fundamental coding concepts in Python. <\/strong>They work with a live, expert instructor who supports them every step of the way. Classes are engaging and you\u2019ll build personalized projects and applications in every lesson.&nbsp;<\/p>\n\n\n\n<p>No matter how you do it, we encourage you to keep practicing your Python!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Whether you love them or hate them, dads always have them at the ready. It\u2019s the classic dad joke.&nbsp; We\u2019ve turned dad\u2019s favorite jokes into a Python app, so anyone can tell a great dad joke at any time. The Random Dad Joke App picks an awesome dad joke from a database and shows it [&hellip;]<\/p>\n","protected":false},"author":336,"featured_media":53213,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"om_disable_all_campaigns":false,"inline_featured_image":false,"_lmt_disableupdate":"","_lmt_disable":"","footnotes":""},"categories":[10809,4758],"tags":[10738,10814],"class_list":["post-53203","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-activities","category-learn-coding","tag-python","tag-tutorials"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v26.8 (Yoast SEO v26.8) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Python Tutorial for Kids: Random Dad Joke App | CodeWizardsHQ<\/title>\n<meta name=\"description\" content=\"Tell a joke using Python code! Beginner Python tutorial shows you how to code your own dad joke app using our dad jokes API. Try it now.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.codewizardshq.com\/python-tutorial-dad-joke-app\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Python Tutorial for Kids: Random Dad Joke App\" \/>\n<meta property=\"og:description\" content=\"Tell a joke using Python code! Beginner Python tutorial shows you how to code your own dad joke app using our dad jokes API. Try it now.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.codewizardshq.com\/python-tutorial-dad-joke-app\/\" \/>\n<meta property=\"og:site_name\" content=\"CodeWizardsHQ\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/codewizardshq\/\" \/>\n<meta property=\"article:published_time\" content=\"2022-12-05T14:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-08-29T09:28:45+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/11\/random-dad-joke-social-banner.png\" \/>\n\t<meta property=\"og:image:width\" content=\"620\" \/>\n\t<meta property=\"og:image:height\" content=\"323\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Daniel Schroeder\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@codewizardshq\" \/>\n<meta name=\"twitter:site\" content=\"@codewizardshq\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Daniel Schroeder\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"5 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\n\t    \"@context\": \"https:\/\/schema.org\",\n\t    \"@graph\": [\n\t        {\n\t            \"@type\": \"Article\",\n\t            \"@id\": \"https:\/\/www.codewizardshq.com\/python-tutorial-dad-joke-app\/#article\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\/\/www.codewizardshq.com\/python-tutorial-dad-joke-app\/\"\n\t            },\n\t            \"author\": {\n\t                \"name\": \"Daniel Schroeder\",\n\t                \"@id\": \"https:\/\/www.codewizardshq.com\/#\/schema\/person\/8f483c66dd46a2d608d50adde5c5c0f2\"\n\t            },\n\t            \"headline\": \"Python Tutorial for Kids: Random Dad Joke App\",\n\t            \"datePublished\": \"2022-12-05T14:00:00+00:00\",\n\t            \"dateModified\": \"2025-08-29T09:28:45+00:00\",\n\t            \"mainEntityOfPage\": {\n\t                \"@id\": \"https:\/\/www.codewizardshq.com\/python-tutorial-dad-joke-app\/\"\n\t            },\n\t            \"wordCount\": 1552,\n\t            \"publisher\": {\n\t                \"@id\": \"https:\/\/www.codewizardshq.com\/#organization\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\/\/www.codewizardshq.com\/python-tutorial-dad-joke-app\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/11\/Python-tutorial-dad-api-jokes.png\",\n\t            \"keywords\": [\n\t                \"Python\",\n\t                \"tutorials\"\n\t            ],\n\t            \"articleSection\": [\n\t                \"Activities\",\n\t                \"Learn Coding\"\n\t            ],\n\t            \"inLanguage\": \"en-US\"\n\t        },\n\t        {\n\t            \"@type\": \"WebPage\",\n\t            \"@id\": \"https:\/\/www.codewizardshq.com\/python-tutorial-dad-joke-app\/\",\n\t            \"url\": \"https:\/\/www.codewizardshq.com\/python-tutorial-dad-joke-app\/\",\n\t            \"name\": \"Python Tutorial for Kids: Random Dad Joke App | CodeWizardsHQ\",\n\t            \"isPartOf\": {\n\t                \"@id\": \"https:\/\/www.codewizardshq.com\/#website\"\n\t            },\n\t            \"primaryImageOfPage\": {\n\t                \"@id\": \"https:\/\/www.codewizardshq.com\/python-tutorial-dad-joke-app\/#primaryimage\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\/\/www.codewizardshq.com\/python-tutorial-dad-joke-app\/#primaryimage\"\n\t            },\n\t            \"thumbnailUrl\": \"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/11\/Python-tutorial-dad-api-jokes.png\",\n\t            \"datePublished\": \"2022-12-05T14:00:00+00:00\",\n\t            \"dateModified\": \"2025-08-29T09:28:45+00:00\",\n\t            \"description\": \"Tell a joke using Python code! Beginner Python tutorial shows you how to code your own dad joke app using our dad jokes API. Try it now.\",\n\t            \"breadcrumb\": {\n\t                \"@id\": \"https:\/\/www.codewizardshq.com\/python-tutorial-dad-joke-app\/#breadcrumb\"\n\t            },\n\t            \"inLanguage\": \"en-US\",\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"ReadAction\",\n\t                    \"target\": [\n\t                        \"https:\/\/www.codewizardshq.com\/python-tutorial-dad-joke-app\/\"\n\t                    ]\n\t                }\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"ImageObject\",\n\t            \"inLanguage\": \"en-US\",\n\t            \"@id\": \"https:\/\/www.codewizardshq.com\/python-tutorial-dad-joke-app\/#primaryimage\",\n\t            \"url\": \"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/11\/Python-tutorial-dad-api-jokes.png\",\n\t            \"contentUrl\": \"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/11\/Python-tutorial-dad-api-jokes.png\",\n\t            \"width\": 1600,\n\t            \"height\": 395,\n\t            \"caption\": \"Python tutorial dad api jokes\"\n\t        },\n\t        {\n\t            \"@type\": \"BreadcrumbList\",\n\t            \"@id\": \"https:\/\/www.codewizardshq.com\/python-tutorial-dad-joke-app\/#breadcrumb\",\n\t            \"itemListElement\": [\n\t                {\n\t                    \"@type\": \"ListItem\",\n\t                    \"position\": 1,\n\t                    \"name\": \"Home\",\n\t                    \"item\": \"https:\/\/www.codewizardshq.com\/\"\n\t                },\n\t                {\n\t                    \"@type\": \"ListItem\",\n\t                    \"position\": 2,\n\t                    \"name\": \"Python Tutorial for Kids: Random Dad Joke App\"\n\t                }\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"WebSite\",\n\t            \"@id\": \"https:\/\/www.codewizardshq.com\/#website\",\n\t            \"url\": \"https:\/\/www.codewizardshq.com\/\",\n\t            \"name\": \"CodeWizardsHQ\",\n\t            \"description\": \"The leading online coding academy for kids and teens ages 8-18\",\n\t            \"publisher\": {\n\t                \"@id\": \"https:\/\/www.codewizardshq.com\/#organization\"\n\t            },\n\t            \"potentialAction\": [\n\t                {\n\t                    \"@type\": \"SearchAction\",\n\t                    \"target\": {\n\t                        \"@type\": \"EntryPoint\",\n\t                        \"urlTemplate\": \"https:\/\/www.codewizardshq.com\/?s={search_term_string}\"\n\t                    },\n\t                    \"query-input\": {\n\t                        \"@type\": \"PropertyValueSpecification\",\n\t                        \"valueRequired\": true,\n\t                        \"valueName\": \"search_term_string\"\n\t                    }\n\t                }\n\t            ],\n\t            \"inLanguage\": \"en-US\"\n\t        },\n\t        {\n\t            \"@type\": \"Organization\",\n\t            \"@id\": \"https:\/\/www.codewizardshq.com\/#organization\",\n\t            \"name\": \"CodeWizardsHQ\",\n\t            \"url\": \"https:\/\/www.codewizardshq.com\/\",\n\t            \"logo\": {\n\t                \"@type\": \"ImageObject\",\n\t                \"inLanguage\": \"en-US\",\n\t                \"@id\": \"https:\/\/www.codewizardshq.com\/#\/schema\/logo\/image\/\",\n\t                \"url\": \"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2016\/08\/blueVertical@2x-e1572141901928.png\",\n\t                \"contentUrl\": \"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2016\/08\/blueVertical@2x-e1572141901928.png\",\n\t                \"width\": 150,\n\t                \"height\": 108,\n\t                \"caption\": \"CodeWizardsHQ\"\n\t            },\n\t            \"image\": {\n\t                \"@id\": \"https:\/\/www.codewizardshq.com\/#\/schema\/logo\/image\/\"\n\t            },\n\t            \"sameAs\": [\n\t                \"https:\/\/www.facebook.com\/codewizardshq\/\",\n\t                \"https:\/\/x.com\/codewizardshq\",\n\t                \"https:\/\/www.instagram.com\/codewizardshq\/\",\n\t                \"https:\/\/www.linkedin.com\/company\/codewizardshq\",\n\t                \"https:\/\/www.pinterest.com\/codewizardshq\/\",\n\t                \"https:\/\/www.youtube.com\/channel\/UC4NM0jfN0LI8_vWtiwLqgGw\"\n\t            ]\n\t        },\n\t        {\n\t            \"@type\": \"Person\",\n\t            \"@id\": \"https:\/\/www.codewizardshq.com\/#\/schema\/person\/8f483c66dd46a2d608d50adde5c5c0f2\",\n\t            \"name\": \"Daniel Schroeder\",\n\t            \"image\": {\n\t                \"@type\": \"ImageObject\",\n\t                \"inLanguage\": \"en-US\",\n\t                \"@id\": \"https:\/\/www.codewizardshq.com\/#\/schema\/person\/image\/\",\n\t                \"url\": \"https:\/\/secure.gravatar.com\/avatar\/8a310902521019d3ffab08d7e0833119829be11c3593564c614e825a12882b09?s=96&d=mm&r=g\",\n\t                \"contentUrl\": \"https:\/\/secure.gravatar.com\/avatar\/8a310902521019d3ffab08d7e0833119829be11c3593564c614e825a12882b09?s=96&d=mm&r=g\",\n\t                \"caption\": \"Daniel Schroeder\"\n\t            },\n\t            \"description\": \"Daniel has been a curriculum developer, instructor, forum moderator, and all-around problem-solver at CodeWizardsHQ since mid-2020. He's passionate about programming and constantly strives to improve educational outcomes by creating practical, fun assignments and pushing students to pursue coding as a creative endeavor.\",\n\t            \"url\": \"https:\/\/www.codewizardshq.com\/author\/danielj\/\"\n\t        }\n\t    ]\n\t}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Python Tutorial for Kids: Random Dad Joke App | CodeWizardsHQ","description":"Tell a joke using Python code! Beginner Python tutorial shows you how to code your own dad joke app using our dad jokes API. Try it now.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.codewizardshq.com\/python-tutorial-dad-joke-app\/","og_locale":"en_US","og_type":"article","og_title":"Python Tutorial for Kids: Random Dad Joke App","og_description":"Tell a joke using Python code! Beginner Python tutorial shows you how to code your own dad joke app using our dad jokes API. Try it now.","og_url":"https:\/\/www.codewizardshq.com\/python-tutorial-dad-joke-app\/","og_site_name":"CodeWizardsHQ","article_publisher":"https:\/\/www.facebook.com\/codewizardshq\/","article_published_time":"2022-12-05T14:00:00+00:00","article_modified_time":"2025-08-29T09:28:45+00:00","og_image":[{"width":620,"height":323,"url":"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/11\/random-dad-joke-social-banner.png","type":"image\/png"}],"author":"Daniel Schroeder","twitter_card":"summary_large_image","twitter_creator":"@codewizardshq","twitter_site":"@codewizardshq","twitter_misc":{"Written by":"Daniel Schroeder","Est. reading time":"5 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.codewizardshq.com\/python-tutorial-dad-joke-app\/#article","isPartOf":{"@id":"https:\/\/www.codewizardshq.com\/python-tutorial-dad-joke-app\/"},"author":{"name":"Daniel Schroeder","@id":"https:\/\/www.codewizardshq.com\/#\/schema\/person\/8f483c66dd46a2d608d50adde5c5c0f2"},"headline":"Python Tutorial for Kids: Random Dad Joke App","datePublished":"2022-12-05T14:00:00+00:00","dateModified":"2025-08-29T09:28:45+00:00","mainEntityOfPage":{"@id":"https:\/\/www.codewizardshq.com\/python-tutorial-dad-joke-app\/"},"wordCount":1552,"publisher":{"@id":"https:\/\/www.codewizardshq.com\/#organization"},"image":{"@id":"https:\/\/www.codewizardshq.com\/python-tutorial-dad-joke-app\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/11\/Python-tutorial-dad-api-jokes.png","keywords":["Python","tutorials"],"articleSection":["Activities","Learn Coding"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.codewizardshq.com\/python-tutorial-dad-joke-app\/","url":"https:\/\/www.codewizardshq.com\/python-tutorial-dad-joke-app\/","name":"Python Tutorial for Kids: Random Dad Joke App | CodeWizardsHQ","isPartOf":{"@id":"https:\/\/www.codewizardshq.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.codewizardshq.com\/python-tutorial-dad-joke-app\/#primaryimage"},"image":{"@id":"https:\/\/www.codewizardshq.com\/python-tutorial-dad-joke-app\/#primaryimage"},"thumbnailUrl":"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/11\/Python-tutorial-dad-api-jokes.png","datePublished":"2022-12-05T14:00:00+00:00","dateModified":"2025-08-29T09:28:45+00:00","description":"Tell a joke using Python code! Beginner Python tutorial shows you how to code your own dad joke app using our dad jokes API. Try it now.","breadcrumb":{"@id":"https:\/\/www.codewizardshq.com\/python-tutorial-dad-joke-app\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.codewizardshq.com\/python-tutorial-dad-joke-app\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codewizardshq.com\/python-tutorial-dad-joke-app\/#primaryimage","url":"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/11\/Python-tutorial-dad-api-jokes.png","contentUrl":"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/11\/Python-tutorial-dad-api-jokes.png","width":1600,"height":395,"caption":"Python tutorial dad api jokes"},{"@type":"BreadcrumbList","@id":"https:\/\/www.codewizardshq.com\/python-tutorial-dad-joke-app\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.codewizardshq.com\/"},{"@type":"ListItem","position":2,"name":"Python Tutorial for Kids: Random Dad Joke App"}]},{"@type":"WebSite","@id":"https:\/\/www.codewizardshq.com\/#website","url":"https:\/\/www.codewizardshq.com\/","name":"CodeWizardsHQ","description":"The leading online coding academy for kids and teens ages 8-18","publisher":{"@id":"https:\/\/www.codewizardshq.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.codewizardshq.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.codewizardshq.com\/#organization","name":"CodeWizardsHQ","url":"https:\/\/www.codewizardshq.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codewizardshq.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2016\/08\/blueVertical@2x-e1572141901928.png","contentUrl":"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2016\/08\/blueVertical@2x-e1572141901928.png","width":150,"height":108,"caption":"CodeWizardsHQ"},"image":{"@id":"https:\/\/www.codewizardshq.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/codewizardshq\/","https:\/\/x.com\/codewizardshq","https:\/\/www.instagram.com\/codewizardshq\/","https:\/\/www.linkedin.com\/company\/codewizardshq","https:\/\/www.pinterest.com\/codewizardshq\/","https:\/\/www.youtube.com\/channel\/UC4NM0jfN0LI8_vWtiwLqgGw"]},{"@type":"Person","@id":"https:\/\/www.codewizardshq.com\/#\/schema\/person\/8f483c66dd46a2d608d50adde5c5c0f2","name":"Daniel Schroeder","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.codewizardshq.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/8a310902521019d3ffab08d7e0833119829be11c3593564c614e825a12882b09?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/8a310902521019d3ffab08d7e0833119829be11c3593564c614e825a12882b09?s=96&d=mm&r=g","caption":"Daniel Schroeder"},"description":"Daniel has been a curriculum developer, instructor, forum moderator, and all-around problem-solver at CodeWizardsHQ since mid-2020. He's passionate about programming and constantly strives to improve educational outcomes by creating practical, fun assignments and pushing students to pursue coding as a creative endeavor.","url":"https:\/\/www.codewizardshq.com\/author\/danielj\/"}]}},"modified_by":"Margaret Choi","featured_image_src":"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/11\/Python-tutorial-dad-api-jokes-600x395.png","featured_image_src_square":"https:\/\/www.codewizardshq.com\/wp-content\/uploads\/2022\/11\/Python-tutorial-dad-api-jokes-600x395.png","author_info":{"display_name":"Daniel Schroeder","author_link":"https:\/\/www.codewizardshq.com\/author\/danielj\/"},"_links":{"self":[{"href":"https:\/\/www.codewizardshq.com\/wp-json\/wp\/v2\/posts\/53203","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.codewizardshq.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.codewizardshq.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.codewizardshq.com\/wp-json\/wp\/v2\/users\/336"}],"replies":[{"embeddable":true,"href":"https:\/\/www.codewizardshq.com\/wp-json\/wp\/v2\/comments?post=53203"}],"version-history":[{"count":2,"href":"https:\/\/www.codewizardshq.com\/wp-json\/wp\/v2\/posts\/53203\/revisions"}],"predecessor-version":[{"id":71750,"href":"https:\/\/www.codewizardshq.com\/wp-json\/wp\/v2\/posts\/53203\/revisions\/71750"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.codewizardshq.com\/wp-json\/wp\/v2\/media\/53213"}],"wp:attachment":[{"href":"https:\/\/www.codewizardshq.com\/wp-json\/wp\/v2\/media?parent=53203"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.codewizardshq.com\/wp-json\/wp\/v2\/categories?post=53203"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.codewizardshq.com\/wp-json\/wp\/v2\/tags?post=53203"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}