{"id":12812,"date":"2023-02-10T07:09:34","date_gmt":"2023-02-10T07:09:34","guid":{"rendered":"https:\/\/www.prepbytes.com\/blog\/?p=12812"},"modified":"2023-07-03T06:19:54","modified_gmt":"2023-07-03T06:19:54","slug":"how-to-use-def-function-in-python","status":"publish","type":"post","link":"https:\/\/prepbytes.com\/blog\/how-to-use-def-function-in-python\/","title":{"rendered":"How to Use Def Function in Python?"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1676268601043-How%20to%20use%20def%20function%20in%20python.jpg\" alt=\"\" \/><\/p>\n<p>Python, renowned for its simplicity and versatility, offers a rich set of features that make it a popular programming language among beginners and experts alike. def in Python serves as the gateway to defining and utilizing functions.<\/p>\n<p>The &quot;def&quot; keyword, short for &quot;define,&quot; is a crucial component of Python&#8217;s syntax that allows developers to create reusable blocks of code. By encapsulating a set of instructions within a named function, programmers can improve code organization, promote code reusability, and enhance the overall efficiency of their programs.<\/p>\n<h2>What is Def in Python?<\/h2>\n<p>In Python, the &quot;def&quot; keyword is used to define a function. A function is a reusable block of code that performs a specific task or a set of instructions. It allows you to break down your code into smaller, manageable pieces, promoting code organization, reusability, and modularity.<br \/>\nThe &quot;def&quot; function declaration starts with the keyword &quot;def,&quot; followed by the name of the function, parentheses (), and a colon (:). <\/p>\n<h2>Working with Python Def<\/h2>\n<p>In order to write functions in python, we are aware of how to write a def keyword, and how it works in simple computing terms and what variation it can have, we will study this in this section.<\/p>\n<h3>Syntax of user-defined function<\/h3>\n<pre><code>def function_name(parameters):\n    \"\"\"Optional documentation string (docstring)\"\"\"\n    code to be executed\n    return [expression]<\/code><\/pre>\n<h3>Components of a Function<\/h3>\n<p>A function comprises the parts as discussed below:- <\/p>\n<ol>\n<li>def keyword<\/li>\n<li>Function name<\/li>\n<li>Function statements<\/li>\n<li>Parameters<\/li>\n<li>Return statement (optional)<\/li>\n<\/ol>\n<p><strong>1\ufe0f. Def Keyword<\/strong><br \/>\nIt is written at the start of the function indicating a user-defined function is being created to be put into use for calling in the later stages of the program.<\/p>\n<p><strong>2\ufe0f. Function Name<\/strong><br \/>\nIt is the name of the function. Advised to name the functions meaningful, accordingly with its purpose, in order to make the program more readable.<\/p>\n<p><strong>3\ufe0f. Function Parameters<\/strong><br \/>\nPassed arguments upon the calling of functions are set as parameters on defining a function using Python Def. The positioning of the parameter depends upon the position or keyword of the arguments.<\/p>\n<p>Let us have a look a how positional and keyword arguments fare among each other.<\/p>\n<p><strong>Position Argument:<\/strong><br \/>\nThe parameters are executed in the order assigned to them at the time of calling the function. Such that an argument at the first position will be ordered first in the parameter.<\/p>\n<pre><code>def print_name(first_name, last_name):\n  print(\"First name:\", first_name)\n  print(\"Last name:\", last_name)\n\nprint_name(\"PrepBytes\", \"Learning\")<\/code><\/pre>\n<p><strong>Output:<\/strong><\/p>\n<pre><code>First name: PrepBytes\nLast name: Learning<\/code><\/pre>\n<p><strong>Keyword Argument:<\/strong><br \/>\nThe parameters are executed in the keyword assigned to them at the time of calling the function. Such that an argument at the first_name will be passed to the parameter named first_name<\/p>\n<pre><code>def print_name(first_name, last_name):\n  print(\"First name:\", first_name)\n  print(\"Last name:\", last_name)\n\nprint_name(first_name=\"PrepBytes\", last_name=\"Learning\")<\/code><\/pre>\n<p><strong>Output:<\/strong><\/p>\n<pre><code>First name: PrepBytes\nLast name: Learning<\/code><\/pre>\n<p><strong>4\ufe0f. Function Statements<\/strong><br \/>\nThese are the actual statements to be executed within the function. Function statements are indented two spaces or four spaces, as per the preference of the user.<\/p>\n<pre><code>def greeting(name):\n    print(\"Hello, \" + name)\n\ngreeting(\"John\")<\/code><\/pre>\n<p>In the above code, Hello John will be printed as our function statement has a print function with name as the function parameter holding the name value.<\/p>\n<p><strong>5\ufe0f. Docstrings<\/strong><br \/>\nStrings that are kept as a commented code inside the function created for the sake of accessibility of the developer to know and store important documentation related to the function. It is another optional preference to keep docstrings inside the function. Accessed using <strong> doc<\/strong>.<\/p>\n<pre><code>def exp(a, b):\n    \"\"\"Returns the power of a raised to the power b\"\"\"\n\n    return a**b\n\nprint(exp.__doc__)<\/code><\/pre>\n<p><strong>6\ufe0f. Return<\/strong><br \/>\nReturn is another optional but useful statement that returns the value back to the called function that requires an output generated from the set of statements generated inside the function.<\/p>\n<p>In given example, we return the square of the number that is passed as an argument.<\/p>\n<pre><code>def sq(x):\n    return x * x\n\nresult = sq(5)\nprint(result)<\/code><\/pre>\n<p><strong>Output:<\/strong><\/p>\n<pre><code>25<\/code><\/pre>\n<p>Among the discussed above, Python Def is the most used keyword in Python Programming Language.<\/p>\n<h2>Implementing Programs using Python Def<\/h2>\n<p>With some solid knowledge of functional programming in python, let us hop on to see how python def can prove to be a handy tool in different scenarios of programming.<\/p>\n<p>In the first of the two examples, we will be finding the multiples of a number up to ten.<\/p>\n\t\t\t\t\t\t<style>\r\n\t\t\t\t\r\n\t\t\t\t\t#tab_container_12814 {\r\n\toverflow:hidden;\r\n\tdisplay:block;\r\n\twidth:100%;\r\n\tborder:0px solid #ddd;\r\n\tmargin-bottom:30px;\r\n\t}\r\n\r\n#tab_container_12814 .tab-content{\r\n\tpadding:20px;\r\n\tborder: 1px solid #e6e6e6 !important;\r\n\tmargin-top: 0px;\r\n\tbackground-color:#ffffff !important;\r\n\tcolor: #000000 !important;\r\n\tfont-size:16px !important;\r\n\tfont-family: Open Sans !important;\r\n\t\r\n\t\tborder: 1px solid #e6e6e6 !important;\r\n\t}\r\n#tab_container_12814 .wpsm_nav-tabs {\r\n    border-bottom: 0px solid #ddd;\r\n}\r\n#tab_container_12814 .wpsm_nav-tabs > li.active > a, #tab_container_12814 .wpsm_nav-tabs > li.active > a:hover, #tab_container_12814 .wpsm_nav-tabs > li.active > a:focus {\r\n\tcolor: #000000 !important;\r\n\tcursor: default;\r\n\tbackground-color: #ffffff !important;\r\n\tborder: 1px solid #e6e6e6 !important;\r\n}\r\n\r\n#tab_container_12814 .wpsm_nav-tabs > li > a {\r\n    margin-right: 0px !important; \r\n    line-height: 1.42857143 !important;\r\n    border: 1px solid #d5d5d5 !important;\r\n    border-radius: 0px 0px 0 0 !important; \r\n\tbackground-color: #e8e8e8 !important;\r\n\tcolor: #000000 !important;\r\n\tpadding: 15px 18px 15px 18px !important;\r\n\ttext-decoration: none !important;\r\n\tfont-size: 14px !important;\r\n\ttext-align:center !important;\r\n\tfont-family: Open Sans !important;\r\n}\r\n#tab_container_12814 .wpsm_nav-tabs > li > a:focus {\r\noutline: 0px !important;\r\n}\r\n\r\n#tab_container_12814 .wpsm_nav-tabs > li > a:before {\r\n\tdisplay:none !important;\r\n}\r\n#tab_container_12814 .wpsm_nav-tabs > li > a:after {\r\n\tdisplay:none !important ;\r\n}\r\n#tab_container_12814 .wpsm_nav-tabs > li{\r\npadding:0px !important ;\r\nmargin:0px;\r\n}\r\n\r\n#tab_container_12814 .wpsm_nav-tabs > li > a:hover , #tab_container_12814 .wpsm_nav-tabs > li > a:focus {\r\n    color: #000000 !important;\r\n    background-color: #e8e8e8 !important;\r\n\tborder: 1px solid #d5d5d5 !important;\r\n\t\r\n}\r\n#tab_container_12814 .wpsm_nav-tabs > li > a .fa{\r\n\r\nmargin-right:5px !important;\r\n\r\nmargin-left:5px !important;\r\n\r\n\r\n}\r\n\r\n\t\t#tab_container_12814 .wpsm_nav-tabs a{\r\n\t\t\tbackground-image: none;\r\n\t\t\tbackground-position: 0 0;\r\n\t\t\tbackground-repeat: repeat-x;\r\n\t\t}\r\n\t\t\t\r\n\r\n\r\n#tab_container_12814 .wpsm_nav-tabs > li {\r\n    float: left;\r\n    margin-bottom: -1px !important;\r\n\tmargin-right:0px !important; \r\n}\r\n\r\n\r\n#tab_container_12814 .tab-content{\r\noverflow:hidden !important;\r\n}\r\n\r\n\r\n@media (min-width: 769px) {\r\n\r\n\t#tab_container_12814 .wpsm_nav-tabs > li{\r\n\t\tfloat:left !important ;\r\n\t\t\t\tmargin-right:-1px !important;\r\n\t\t\t\t\t}\r\n\t#tab_container_12814 .wpsm_nav-tabs{\r\n\t\tfloat:none !important;\r\n\t\tmargin:0px !important;\r\n\t}\r\n\r\n\t#tab_container_12814 .wpsm_nav-tabs > li {\r\n\t\t\t\t\r\n\t}\r\n\t#tab_container_12814 .wpsm_nav{\r\n\t\t\t}\r\n\r\n}\r\n\r\n\r\n\r\n@media (max-width: 768px) {\r\n\t#tab_container_12814 .wpsm_nav-tabs > li {\r\n\t\t\t\t\r\n\t}\r\n\t#tab_container_12814 .wpsm_nav{\r\n\t\t\t}\r\n}\r\n\r\n\r\n\t.wpsm_nav-tabs li:before{\r\n\t\tdisplay:none !important;\r\n\t}\r\n\r\n\t@media (max-width: 768px) {\r\n\t\t\t\t\r\n\t\t\t\t.wpsm_nav-tabs{\r\n\t\t\tmargin-left:0px !important;\r\n\t\t\tmargin-right:0px !important; \r\n\t\t\t\r\n\t\t}\r\n\t\t\t\t#tab_container_12814 .wpsm_nav-tabs > li{\r\n\t\t\tfloat:none !important;\r\n\t\t}\r\n\t\t\t\r\n\t}\t\t\t\t<\/style>\r\n\t\t\t\t<div id=\"tab_container_12814\" >\r\n\t \r\n\t\t\t\t\t<ul class=\"wpsm_nav wpsm_nav-tabs\" role=\"tablist\" id=\"myTab_12814\">\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t<li role=\"presentation\"  class=\"active\"  onclick=\"do_resize()\">\r\n\t\t\t\t\t\t\t\t<a href=\"#tabs_desc_12814_1\" aria-controls=\"tabs_desc_12814_1\" role=\"tab\" data-toggle=\"tab\">\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"fa fa-code\"><\/i> \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t<span>Python<\/span>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t<\/a>\r\n\t\t\t\t\t\t\t<\/li>\r\n\t\t\t\t\t\t\t\t\t\t\t <\/ul>\r\n\r\n\t\t\t\t\t  <!-- Tab panes -->\r\n\t\t\t\t\t  <div class=\"tab-content\" id=\"tab-content_12814\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t <div role=\"tabpanel\" class=\"tab-pane  in active \" id=\"tabs_desc_12814_1\">\r\n\t\t\t\t\t\t\t\t<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">def print_multiples(n):\r\n    for i in range(1, 11):\r\n        print(n * i)\r\n\r\n# Call the function with a number\r\nprint_multiples(3)\r\n<\/pre>\t\t\t\t\t\t <\/div>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t <\/div>\r\n\t\t\t\t\t \r\n\t\t\t\t <\/div>\r\n <script>\r\n\t\tjQuery(function () {\r\n\t\t\tjQuery('#myTab_12814 a:first').tab('show')\r\n\t\t});\r\n\t\t\r\n\t\t\t\tjQuery(function(){\r\n\t\t\tvar b=\"fadeIn\";\r\n\t\t\tvar c;\r\n\t\t\tvar a;\r\n\t\t\td(jQuery(\"#myTab_12814 a\"),jQuery(\"#tab-content_12814\"));function d(e,f,g){\r\n\t\t\t\te.click(function(i){\r\n\t\t\t\t\ti.preventDefault();\r\n\t\t\t\t\tjQuery(this).tab(\"show\");\r\n\t\t\t\t\tvar h=jQuery(this).data(\"easein\");\r\n\t\t\t\t\tif(c){c.removeClass(a);}\r\n\t\t\t\t\tif(h){f.find(\"div.active\").addClass(\"animated \"+h);a=h;}\r\n\t\t\t\t\telse{if(g){f.find(\"div.active\").addClass(\"animated \"+g);a=g;}else{f.find(\"div.active\").addClass(\"animated \"+b);a=b;}}c=f.find(\"div.active\");\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t});\r\n\t\t\r\n\r\n\t\tfunction do_resize(){\r\n\r\n\t\t\tvar width=jQuery( '.tab-content .tab-pane iframe' ).width();\r\n\t\t\tvar height=jQuery( '.tab-content .tab-pane iframe' ).height();\r\n\r\n\t\t\tvar toggleSize = true;\r\n\t\t\tjQuery('iframe').animate({\r\n\t\t\t    width: toggleSize ? width : 640,\r\n\t\t\t    height: toggleSize ? height : 360\r\n\t\t\t  }, 250);\r\n\r\n\t\t\t  toggleSize = !toggleSize;\r\n\t\t}\r\n\r\n\r\n\t<\/script>\r\n\t\t\t\t\r\n\t\t\t\n<p><strong>Output:<\/strong><\/p>\n<pre><code>3 6 9 12 15 18 21 24 27 30<\/code><\/pre>\n<p><strong>Explanation:<\/strong><br \/>\nA function named print_multiples is defined using the python def keyword that takes in an input i.e. 3 passed and it runs a loop from 1 to 10 as 11 won&#8217;t be considered in for loop such that we will get the first 10 multiples of 3 as our output.<\/p>\n<p>In the second example, we will be printing the first n prime numbers by defining a user-defined function using the python def keyword.<\/p>\n\t\t\t\t\t\t<style>\r\n\t\t\t\t\r\n\t\t\t\t\t#tab_container_12815 {\r\n\toverflow:hidden;\r\n\tdisplay:block;\r\n\twidth:100%;\r\n\tborder:0px solid #ddd;\r\n\tmargin-bottom:30px;\r\n\t}\r\n\r\n#tab_container_12815 .tab-content{\r\n\tpadding:20px;\r\n\tborder: 1px solid #e6e6e6 !important;\r\n\tmargin-top: 0px;\r\n\tbackground-color:#ffffff !important;\r\n\tcolor: #000000 !important;\r\n\tfont-size:16px !important;\r\n\tfont-family: Open Sans !important;\r\n\t\r\n\t\tborder: 1px solid #e6e6e6 !important;\r\n\t}\r\n#tab_container_12815 .wpsm_nav-tabs {\r\n    border-bottom: 0px solid #ddd;\r\n}\r\n#tab_container_12815 .wpsm_nav-tabs > li.active > a, #tab_container_12815 .wpsm_nav-tabs > li.active > a:hover, #tab_container_12815 .wpsm_nav-tabs > li.active > a:focus {\r\n\tcolor: #000000 !important;\r\n\tcursor: default;\r\n\tbackground-color: #ffffff !important;\r\n\tborder: 1px solid #e6e6e6 !important;\r\n}\r\n\r\n#tab_container_12815 .wpsm_nav-tabs > li > a {\r\n    margin-right: 0px !important; \r\n    line-height: 1.42857143 !important;\r\n    border: 1px solid #d5d5d5 !important;\r\n    border-radius: 0px 0px 0 0 !important; \r\n\tbackground-color: #e8e8e8 !important;\r\n\tcolor: #000000 !important;\r\n\tpadding: 15px 18px 15px 18px !important;\r\n\ttext-decoration: none !important;\r\n\tfont-size: 14px !important;\r\n\ttext-align:center !important;\r\n\tfont-family: Open Sans !important;\r\n}\r\n#tab_container_12815 .wpsm_nav-tabs > li > a:focus {\r\noutline: 0px !important;\r\n}\r\n\r\n#tab_container_12815 .wpsm_nav-tabs > li > a:before {\r\n\tdisplay:none !important;\r\n}\r\n#tab_container_12815 .wpsm_nav-tabs > li > a:after {\r\n\tdisplay:none !important ;\r\n}\r\n#tab_container_12815 .wpsm_nav-tabs > li{\r\npadding:0px !important ;\r\nmargin:0px;\r\n}\r\n\r\n#tab_container_12815 .wpsm_nav-tabs > li > a:hover , #tab_container_12815 .wpsm_nav-tabs > li > a:focus {\r\n    color: #000000 !important;\r\n    background-color: #e8e8e8 !important;\r\n\tborder: 1px solid #d5d5d5 !important;\r\n\t\r\n}\r\n#tab_container_12815 .wpsm_nav-tabs > li > a .fa{\r\n\r\nmargin-right:5px !important;\r\n\r\nmargin-left:5px !important;\r\n\r\n\r\n}\r\n\r\n\t\t#tab_container_12815 .wpsm_nav-tabs a{\r\n\t\t\tbackground-image: none;\r\n\t\t\tbackground-position: 0 0;\r\n\t\t\tbackground-repeat: repeat-x;\r\n\t\t}\r\n\t\t\t\r\n\r\n\r\n#tab_container_12815 .wpsm_nav-tabs > li {\r\n    float: left;\r\n    margin-bottom: -1px !important;\r\n\tmargin-right:0px !important; \r\n}\r\n\r\n\r\n#tab_container_12815 .tab-content{\r\noverflow:hidden !important;\r\n}\r\n\r\n\r\n@media (min-width: 769px) {\r\n\r\n\t#tab_container_12815 .wpsm_nav-tabs > li{\r\n\t\tfloat:left !important ;\r\n\t\t\t\tmargin-right:-1px !important;\r\n\t\t\t\t\t}\r\n\t#tab_container_12815 .wpsm_nav-tabs{\r\n\t\tfloat:none !important;\r\n\t\tmargin:0px !important;\r\n\t}\r\n\r\n\t#tab_container_12815 .wpsm_nav-tabs > li {\r\n\t\t\t\t\r\n\t}\r\n\t#tab_container_12815 .wpsm_nav{\r\n\t\t\t}\r\n\r\n}\r\n\r\n\r\n\r\n@media (max-width: 768px) {\r\n\t#tab_container_12815 .wpsm_nav-tabs > li {\r\n\t\t\t\t\r\n\t}\r\n\t#tab_container_12815 .wpsm_nav{\r\n\t\t\t}\r\n}\r\n\r\n\r\n\t.wpsm_nav-tabs li:before{\r\n\t\tdisplay:none !important;\r\n\t}\r\n\r\n\t@media (max-width: 768px) {\r\n\t\t\t\t\r\n\t\t\t\t.wpsm_nav-tabs{\r\n\t\t\tmargin-left:0px !important;\r\n\t\t\tmargin-right:0px !important; \r\n\t\t\t\r\n\t\t}\r\n\t\t\t\t#tab_container_12815 .wpsm_nav-tabs > li{\r\n\t\t\tfloat:none !important;\r\n\t\t}\r\n\t\t\t\r\n\t}\t\t\t\t<\/style>\r\n\t\t\t\t<div id=\"tab_container_12815\" >\r\n\t \r\n\t\t\t\t\t<ul class=\"wpsm_nav wpsm_nav-tabs\" role=\"tablist\" id=\"myTab_12815\">\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t<li role=\"presentation\"  class=\"active\"  onclick=\"do_resize()\">\r\n\t\t\t\t\t\t\t\t<a href=\"#tabs_desc_12815_1\" aria-controls=\"tabs_desc_12815_1\" role=\"tab\" data-toggle=\"tab\">\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<i class=\"fa fa-code\"><\/i> \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t<span>Python<\/span>\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t\t\r\n\t\t\t\t\t\t\t\t<\/a>\r\n\t\t\t\t\t\t\t<\/li>\r\n\t\t\t\t\t\t\t\t\t\t\t <\/ul>\r\n\r\n\t\t\t\t\t  <!-- Tab panes -->\r\n\t\t\t\t\t  <div class=\"tab-content\" id=\"tab-content_12815\">\r\n\t\t\t\t\t\t\t\t\t\t\t\t <div role=\"tabpanel\" class=\"tab-pane  in active \" id=\"tabs_desc_12815_1\">\r\n\t\t\t\t\t\t\t\t<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"python\">def generate_prime_numbers(limit):\r\n    \"\"\"\r\n    This function generates and prints the first `limit` prime numbers.\r\n    \"\"\"\r\n    number = 2\r\n    prime_count = 0\r\n    while prime_count &lt; limit:\r\n        for divisor in range(2, number):\r\n            if number % divisor == 0:\r\n                break\r\n        else:\r\n            print(number,end=\" \")\r\n            prime_count += 1\r\n        number += 1\r\n\r\n# Driver code\r\nlimit = 10\r\n\r\n# Printing the first 10 prime numbers\r\nprint(\"The first 10 prime numbers are:\")\r\ngenerate_prime_numbers(limit)<\/pre>\t\t\t\t\t\t <\/div>\r\n\t\t\t\t\t\t\t\r\n\t\t\t\t\t <\/div>\r\n\t\t\t\t\t \r\n\t\t\t\t <\/div>\r\n <script>\r\n\t\tjQuery(function () {\r\n\t\t\tjQuery('#myTab_12815 a:first').tab('show')\r\n\t\t});\r\n\t\t\r\n\t\t\t\tjQuery(function(){\r\n\t\t\tvar b=\"fadeIn\";\r\n\t\t\tvar c;\r\n\t\t\tvar a;\r\n\t\t\td(jQuery(\"#myTab_12815 a\"),jQuery(\"#tab-content_12815\"));function d(e,f,g){\r\n\t\t\t\te.click(function(i){\r\n\t\t\t\t\ti.preventDefault();\r\n\t\t\t\t\tjQuery(this).tab(\"show\");\r\n\t\t\t\t\tvar h=jQuery(this).data(\"easein\");\r\n\t\t\t\t\tif(c){c.removeClass(a);}\r\n\t\t\t\t\tif(h){f.find(\"div.active\").addClass(\"animated \"+h);a=h;}\r\n\t\t\t\t\telse{if(g){f.find(\"div.active\").addClass(\"animated \"+g);a=g;}else{f.find(\"div.active\").addClass(\"animated \"+b);a=b;}}c=f.find(\"div.active\");\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t});\r\n\t\t\r\n\r\n\t\tfunction do_resize(){\r\n\r\n\t\t\tvar width=jQuery( '.tab-content .tab-pane iframe' ).width();\r\n\t\t\tvar height=jQuery( '.tab-content .tab-pane iframe' ).height();\r\n\r\n\t\t\tvar toggleSize = true;\r\n\t\t\tjQuery('iframe').animate({\r\n\t\t\t    width: toggleSize ? width : 640,\r\n\t\t\t    height: toggleSize ? height : 360\r\n\t\t\t  }, 250);\r\n\r\n\t\t\t  toggleSize = !toggleSize;\r\n\t\t}\r\n\r\n\r\n\t<\/script>\r\n\t\t\t\t\r\n\t\t\t\n<p><strong>Output:<\/strong><\/p>\n<pre><code>The first 10 prime numbers are:\n2 3 5 7 11 13 17 19 23 29<\/code><\/pre>\n<p><strong>Explanation:<\/strong><br \/>\nWe define a function with Python def that finds out the first n number of prime numbers, a prime count object will check for the number of the prime numbers printed and once it reaches the threshold, the program is terminated with results. <\/p>\n<h2>Applications of Def Keyword<\/h2>\n<p>As we approach the completion of the article on Python Def discussing the theoretical, syntactical and program implementation, let us discuss the most frequent use cases of Python Def Keyword.<\/p>\n<ol>\n<li>\n<p><strong>Recursion<\/strong><br \/>\nRecursion is one of the important parts of functional programming and the python def keyword is the initial step to get started with the practice of writing a recursive function.<\/p>\n<\/li>\n<li>\n<p><strong>Object-Oriented Programming<\/strong><br \/>\nRight from making an <strong>init<\/strong> constructor work to implementing the practices of abstraction. Def remains to be essential in constructive object-oriented programming paradigms.<\/p>\n<\/li>\n<li>\n<p><strong>Testing<\/strong><br \/>\nOnce modularity is achieved, components can be tested efficiently using user-defined functions.<\/p>\n<\/li>\n<li>\n<p><strong>Reusability<\/strong><br \/>\nOnce created, the function is ever-accessible without any hassle, hence reusability is achieved.<\/p>\n<\/li>\n<\/ol>\n<p><strong>Conclusion<\/strong><br \/>\nIn conclusion, the &quot;def&quot; function in Python is a fundamental and powerful feature that allows programmers to define their own functions. By encapsulating a block of code within a named function, developers can promote code reusability, modularity, and organization, leading to more efficient and maintainable programs.<\/p>\n<p>Throughout this article, we have explored various aspects of using the &quot;def&quot; function, starting from the basics of function definition syntax and parameter passing, to more advanced concepts such as return values, variable scope, and recursion. We have seen how functions provide code reusability, improve readability, and enhance the overall structure of our programs.<\/p>\n<h2>Frequently Asked Questions on Python Define Function<\/h2>\n<p><strong>Q1: What is a function in Python?<\/strong><br \/>\nA function in Python is a named block of reusable code that performs a specific task or a set of instructions. It is defined using the &quot;def&quot; keyword followed by the function name, parentheses, and a colon. Functions can take input parameters, perform operations, and optionally return a value.<\/p>\n<p><strong>Q2: How do I define a function in Python?<\/strong><br \/>\nTo define a function in Python, use the &quot;def&quot; keyword followed by the function name, parentheses for parameters (if any), and a colon. The function body is indented below the definition line. Here&#8217;s an example:<\/p>\n<pre><code>def greet(name):\n    print(\"Hello, \" + name + \"!\")\n\ngreet(\"Alice\")  # Output: Hello, Alice!<\/code><\/pre>\n<p><strong>Q3: Can a function in Python return multiple values?<\/strong><br \/>\nYes, a function in Python can return multiple values by separating them with commas. You can return multiple values as a tuple, which can be unpacked into separate variables when calling the function. Here&#8217;s an example:<br \/>\ndef get_coordinates():<br \/>\nx = 10<br \/>\ny = 20<br \/>\nreturn x, y<\/p>\n<p>x_value, y_value = get_coordinates()<br \/>\nprint(&quot;x =&quot;, x_value)  # Output: x = 10<br \/>\nprint(&quot;y =&quot;, y_value)  # Output: y = 20<\/p>\n<p><strong>Q4: What is a default parameter in Python?<\/strong><br \/>\nA default parameter is a parameter in a function that has a predefined default value. If an argument is not passed for a default parameter, the default value is used instead. This allows for more flexible function calls. Here&#8217;s an example:<\/p>\n<pre><code>def greet(name=\"John\"):\n    print(\"Hello, \" + name + \"!\")\n\ngreet()        # Output: Hello, John!\ngreet(\"Alice\") # Output: Hello, Alice!<\/code><\/pre>\n<p><strong>Q5: What is recursion in Python?<\/strong><br \/>\nRecursion is a technique in which a function calls itself to solve a problem by breaking it down into smaller subproblems. Each recursive call reduces the problem until it reaches a base case, where the function does not call itself anymore. Recursion is useful for solving problems that can be divided into identical or similar subproblems.<\/p>\n<p><strong>Q6: Can a Python function return more than one value?<\/strong><br \/>\nYes, a Python function can return more than one value using tuple packing and unpacking or by using the return statement multiple times.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python, renowned for its simplicity and versatility, offers a rich set of features that make it a popular programming language among beginners and experts alike. def in Python serves as the gateway to defining and utilizing functions. The &quot;def&quot; keyword, short for &quot;define,&quot; is a crucial component of Python&#8217;s syntax that allows developers to create [&hellip;]<\/p>\n","protected":false},"author":52,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[154],"tags":[],"class_list":["post-12812","post","type-post","status-publish","format-standard","hentry","category-python"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.8 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>How to Use Def Function in Python?<\/title>\n<meta name=\"description\" content=\"We will study how to write a def keyword, how does it work in simple computing terms and what variation it can have.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/prepbytes.com\/blog\/how-to-use-def-function-in-python\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Use Def Function in Python?\" \/>\n<meta property=\"og:description\" content=\"We will study how to write a def keyword, how does it work in simple computing terms and what variation it can have.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/prepbytes.com\/blog\/how-to-use-def-function-in-python\/\" \/>\n<meta property=\"og:site_name\" content=\"PrepBytes Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/prepbytes0211\/\" \/>\n<meta property=\"article:published_time\" content=\"2023-02-10T07:09:34+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-07-03T06:19:54+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1676268601043-How%20to%20use%20def%20function%20in%20python.jpg\" \/>\n<meta name=\"author\" content=\"Prepbytes\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Prepbytes\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/prepbytes.com\/blog\/how-to-use-def-function-in-python\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/how-to-use-def-function-in-python\/\"},\"author\":{\"name\":\"Prepbytes\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/person\/3f7dc4ae851791d5947a7f99df363d5e\"},\"headline\":\"How to Use Def Function in Python?\",\"datePublished\":\"2023-02-10T07:09:34+00:00\",\"dateModified\":\"2023-07-03T06:19:54+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/how-to-use-def-function-in-python\/\"},\"wordCount\":1320,\"commentCount\":0,\"publisher\":{\"@id\":\"http:\/\/43.205.93.38\/#organization\"},\"image\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/how-to-use-def-function-in-python\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1676268601043-How%20to%20use%20def%20function%20in%20python.jpg\",\"articleSection\":[\"Python\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/prepbytes.com\/blog\/how-to-use-def-function-in-python\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/prepbytes.com\/blog\/how-to-use-def-function-in-python\/\",\"url\":\"https:\/\/prepbytes.com\/blog\/how-to-use-def-function-in-python\/\",\"name\":\"How to Use Def Function in Python?\",\"isPartOf\":{\"@id\":\"http:\/\/43.205.93.38\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/how-to-use-def-function-in-python\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/how-to-use-def-function-in-python\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1676268601043-How%20to%20use%20def%20function%20in%20python.jpg\",\"datePublished\":\"2023-02-10T07:09:34+00:00\",\"dateModified\":\"2023-07-03T06:19:54+00:00\",\"description\":\"We will study how to write a def keyword, how does it work in simple computing terms and what variation it can have.\",\"breadcrumb\":{\"@id\":\"https:\/\/prepbytes.com\/blog\/how-to-use-def-function-in-python\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/prepbytes.com\/blog\/how-to-use-def-function-in-python\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/prepbytes.com\/blog\/how-to-use-def-function-in-python\/#primaryimage\",\"url\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1676268601043-How%20to%20use%20def%20function%20in%20python.jpg\",\"contentUrl\":\"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1676268601043-How%20to%20use%20def%20function%20in%20python.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/prepbytes.com\/blog\/how-to-use-def-function-in-python\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"http:\/\/43.205.93.38\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Python\",\"item\":\"https:\/\/prepbytes.com\/blog\/category\/python\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"How to Use Def Function in Python?\"}]},{\"@type\":\"WebSite\",\"@id\":\"http:\/\/43.205.93.38\/#website\",\"url\":\"http:\/\/43.205.93.38\/\",\"name\":\"PrepBytes Blog\",\"description\":\"ONE-STOP RESOURCE FOR EVERYTHING RELATED TO CODING\",\"publisher\":{\"@id\":\"http:\/\/43.205.93.38\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"http:\/\/43.205.93.38\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"http:\/\/43.205.93.38\/#organization\",\"name\":\"Prepbytes\",\"url\":\"http:\/\/43.205.93.38\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/blog.prepbytes.com\/wp-content\/uploads\/2025\/07\/uzxxllgloialmn9mhwfe.webp\",\"contentUrl\":\"https:\/\/blog.prepbytes.com\/wp-content\/uploads\/2025\/07\/uzxxllgloialmn9mhwfe.webp\",\"width\":160,\"height\":160,\"caption\":\"Prepbytes\"},\"image\":{\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/prepbytes0211\/\",\"https:\/\/www.instagram.com\/prepbytes\/\",\"https:\/\/www.linkedin.com\/company\/prepbytes\/\",\"https:\/\/www.youtube.com\/channel\/UC0xGnHDrjUM1pDEK2Ka5imA\"]},{\"@type\":\"Person\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/person\/3f7dc4ae851791d5947a7f99df363d5e\",\"name\":\"Prepbytes\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/43.205.93.38\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/232042cd1a1ea0e982c96d2a2ec93fb70a8e864e00784491231e7bfe5a9e06b5?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/232042cd1a1ea0e982c96d2a2ec93fb70a8e864e00784491231e7bfe5a9e06b5?s=96&d=mm&r=g\",\"caption\":\"Prepbytes\"},\"url\":\"https:\/\/prepbytes.com\/blog\/author\/gourav-jaincollegedekho-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Use Def Function in Python?","description":"We will study how to write a def keyword, how does it work in simple computing terms and what variation it can have.","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:\/\/prepbytes.com\/blog\/how-to-use-def-function-in-python\/","og_locale":"en_US","og_type":"article","og_title":"How to Use Def Function in Python?","og_description":"We will study how to write a def keyword, how does it work in simple computing terms and what variation it can have.","og_url":"https:\/\/prepbytes.com\/blog\/how-to-use-def-function-in-python\/","og_site_name":"PrepBytes Blog","article_publisher":"https:\/\/www.facebook.com\/prepbytes0211\/","article_published_time":"2023-02-10T07:09:34+00:00","article_modified_time":"2023-07-03T06:19:54+00:00","og_image":[{"url":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1676268601043-How%20to%20use%20def%20function%20in%20python.jpg","type":"","width":"","height":""}],"author":"Prepbytes","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Prepbytes","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/prepbytes.com\/blog\/how-to-use-def-function-in-python\/#article","isPartOf":{"@id":"https:\/\/prepbytes.com\/blog\/how-to-use-def-function-in-python\/"},"author":{"name":"Prepbytes","@id":"http:\/\/43.205.93.38\/#\/schema\/person\/3f7dc4ae851791d5947a7f99df363d5e"},"headline":"How to Use Def Function in Python?","datePublished":"2023-02-10T07:09:34+00:00","dateModified":"2023-07-03T06:19:54+00:00","mainEntityOfPage":{"@id":"https:\/\/prepbytes.com\/blog\/how-to-use-def-function-in-python\/"},"wordCount":1320,"commentCount":0,"publisher":{"@id":"http:\/\/43.205.93.38\/#organization"},"image":{"@id":"https:\/\/prepbytes.com\/blog\/how-to-use-def-function-in-python\/#primaryimage"},"thumbnailUrl":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1676268601043-How%20to%20use%20def%20function%20in%20python.jpg","articleSection":["Python"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/prepbytes.com\/blog\/how-to-use-def-function-in-python\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/prepbytes.com\/blog\/how-to-use-def-function-in-python\/","url":"https:\/\/prepbytes.com\/blog\/how-to-use-def-function-in-python\/","name":"How to Use Def Function in Python?","isPartOf":{"@id":"http:\/\/43.205.93.38\/#website"},"primaryImageOfPage":{"@id":"https:\/\/prepbytes.com\/blog\/how-to-use-def-function-in-python\/#primaryimage"},"image":{"@id":"https:\/\/prepbytes.com\/blog\/how-to-use-def-function-in-python\/#primaryimage"},"thumbnailUrl":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1676268601043-How%20to%20use%20def%20function%20in%20python.jpg","datePublished":"2023-02-10T07:09:34+00:00","dateModified":"2023-07-03T06:19:54+00:00","description":"We will study how to write a def keyword, how does it work in simple computing terms and what variation it can have.","breadcrumb":{"@id":"https:\/\/prepbytes.com\/blog\/how-to-use-def-function-in-python\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/prepbytes.com\/blog\/how-to-use-def-function-in-python\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/prepbytes.com\/blog\/how-to-use-def-function-in-python\/#primaryimage","url":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1676268601043-How%20to%20use%20def%20function%20in%20python.jpg","contentUrl":"https:\/\/prepbytes-misc-images.s3.ap-south-1.amazonaws.com\/assets\/1676268601043-How%20to%20use%20def%20function%20in%20python.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/prepbytes.com\/blog\/how-to-use-def-function-in-python\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"http:\/\/43.205.93.38\/"},{"@type":"ListItem","position":2,"name":"Python","item":"https:\/\/prepbytes.com\/blog\/category\/python\/"},{"@type":"ListItem","position":3,"name":"How to Use Def Function in Python?"}]},{"@type":"WebSite","@id":"http:\/\/43.205.93.38\/#website","url":"http:\/\/43.205.93.38\/","name":"PrepBytes Blog","description":"ONE-STOP RESOURCE FOR EVERYTHING RELATED TO CODING","publisher":{"@id":"http:\/\/43.205.93.38\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"http:\/\/43.205.93.38\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"http:\/\/43.205.93.38\/#organization","name":"Prepbytes","url":"http:\/\/43.205.93.38\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/43.205.93.38\/#\/schema\/logo\/image\/","url":"https:\/\/blog.prepbytes.com\/wp-content\/uploads\/2025\/07\/uzxxllgloialmn9mhwfe.webp","contentUrl":"https:\/\/blog.prepbytes.com\/wp-content\/uploads\/2025\/07\/uzxxllgloialmn9mhwfe.webp","width":160,"height":160,"caption":"Prepbytes"},"image":{"@id":"http:\/\/43.205.93.38\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/prepbytes0211\/","https:\/\/www.instagram.com\/prepbytes\/","https:\/\/www.linkedin.com\/company\/prepbytes\/","https:\/\/www.youtube.com\/channel\/UC0xGnHDrjUM1pDEK2Ka5imA"]},{"@type":"Person","@id":"http:\/\/43.205.93.38\/#\/schema\/person\/3f7dc4ae851791d5947a7f99df363d5e","name":"Prepbytes","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/43.205.93.38\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/232042cd1a1ea0e982c96d2a2ec93fb70a8e864e00784491231e7bfe5a9e06b5?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/232042cd1a1ea0e982c96d2a2ec93fb70a8e864e00784491231e7bfe5a9e06b5?s=96&d=mm&r=g","caption":"Prepbytes"},"url":"https:\/\/prepbytes.com\/blog\/author\/gourav-jaincollegedekho-com\/"}]}},"_links":{"self":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts\/12812","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/users\/52"}],"replies":[{"embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/comments?post=12812"}],"version-history":[{"count":5,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts\/12812\/revisions"}],"predecessor-version":[{"id":17056,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/posts\/12812\/revisions\/17056"}],"wp:attachment":[{"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/media?parent=12812"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/categories?post=12812"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/prepbytes.com\/blog\/wp-json\/wp\/v2\/tags?post=12812"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}