{"id":64,"date":"2026-03-01T15:56:27","date_gmt":"2026-03-01T10:56:27","guid":{"rendered":"https:\/\/gigz.pk\/python\/?post_type=lesson&#038;p=64"},"modified":"2026-03-13T10:32:42","modified_gmt":"2026-03-13T05:32:42","slug":"function-parameters","status":"publish","type":"lesson","link":"https:\/\/gigz.pk\/python\/lesson\/function-parameters\/","title":{"rendered":"Function Parameters"},"content":{"rendered":"\n<p>Function parameters allow you to pass data into a function so it can perform operations using that data.<br>They make functions flexible and reusable.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>WHAT ARE PARAMETERS?<\/strong><\/h1>\n\n\n\n<p>Parameters are variables listed inside the parentheses when defining a function.<\/p>\n\n\n\n<p>Arguments are the actual values passed when calling the function.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">def greet(name):   # name is a parameter<br>    print(\"Hello\", name)greet(\"Hira\")      # \"Hira\" is an argument<\/pre>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>TYPES OF FUNCTION PARAMETERS<\/strong><\/h1>\n\n\n\n<p>Python supports different types of parameters.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>1. POSITIONAL PARAMETERS<\/strong><\/h1>\n\n\n\n<p>These are the most common type.<br>Values are assigned based on their position.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">def add(a, b):<br>    return a + bprint(add(5, 3))<\/pre>\n\n\n\n<p>Here, 5 is assigned to <code>a<\/code> and 3 to <code>b<\/code>.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>2. KEYWORD PARAMETERS<\/strong><\/h1>\n\n\n\n<p>You can specify arguments by parameter name.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">def student(name, age):<br>    print(\"Name:\", name)<br>    print(\"Age:\", age)student(age=20, name=\"Ali\")<\/pre>\n\n\n\n<p>Order does not matter when using keyword arguments.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>3. DEFAULT PARAMETERS<\/strong><\/h1>\n\n\n\n<p>You can assign default values to parameters.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">def greet(name=\"Guest\"):<br>    print(\"Hello\", name)greet()<br>greet(\"Sara\")<\/pre>\n\n\n\n<p>If no argument is provided, the default value is used.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>4. VARIABLE-LENGTH PARAMETERS<\/strong><\/h1>\n\n\n\n<p>Sometimes you don\u2019t know how many arguments will be passed.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">*args (Non-Keyword Arguments)<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">def add_numbers(*numbers):<br>    total = 0<br>    for num in numbers:<br>        total += num<br>    return totalprint(add_numbers(1, 2, 3, 4))<\/pre>\n\n\n\n<p><code>*args<\/code> collects multiple positional arguments into a tuple.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">**kwargs (Keyword Arguments)<\/h2>\n\n\n\n<pre class=\"wp-block-preformatted\">def display_info(**info):<br>    for key, value in info.items():<br>        print(key, \":\", value)display_info(name=\"Hira\", age=25)<\/pre>\n\n\n\n<p><code>**kwargs<\/code> collects multiple keyword arguments into a dictionary.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>IMPORTANT RULES<\/strong><\/h1>\n\n\n\n<p>\u2022 Positional arguments must come before keyword arguments<br>\u2022 Default parameters must come after required parameters<br>\u2022 *args comes before **kwargs in function definition<\/p>\n\n\n\n<p>Example order:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">def example(a, b=10, *args, **kwargs):<br>    pass<\/pre>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>WHY PARAMETERS ARE IMPORTANT<\/strong><\/h1>\n\n\n\n<p>\u2022 Make functions reusable<br>\u2022 Allow dynamic input<br>\u2022 Help build flexible applications<br>\u2022 Reduce code duplication<\/p>\n\n\n\n<p>Understanding function parameters helps you write powerful and professional Python programs.<\/p>\n\n\n<div class=\"yoast-breadcrumbs\"><span><span><a href=\"https:\/\/gigz.pk\/python\/\">Home<\/a><\/span> \u00bb <span class=\"breadcrumb_last\" aria-current=\"page\">PYTHON FUNDAMENTALS (PYF) > Functions > Function Parameters<\/span><\/span><\/div>\n\n\n<div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1773379141138\"><strong class=\"schema-faq-question\"><\/strong> <p class=\"schema-faq-answer\"><\/p> <\/div> <\/div>\n\n\n\n<p><\/p>\n","protected":false},"menu_order":22,"template":"","class_list":["post-64","lesson","type-lesson","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Function Parameters - One Language. Endless Possibilities<\/title>\n<meta name=\"description\" content=\"Learn Python function parameters: use positional, keyword, default, *args, **kwargs to write flexible and reusable functions.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/gigz.pk\/python\/lesson\/function-parameters\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Function Parameters - One Language. Endless Possibilities\" \/>\n<meta property=\"og:description\" content=\"Learn Python function parameters: use positional, keyword, default, *args, **kwargs to write flexible and reusable functions.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/gigz.pk\/python\/lesson\/function-parameters\/\" \/>\n<meta property=\"og:site_name\" content=\"One Language. Endless Possibilities\" \/>\n<meta property=\"article:modified_time\" content=\"2026-03-13T05:32:42+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":[\"WebPage\",\"FAQPage\"],\"@id\":\"https:\\\/\\\/gigz.pk\\\/python\\\/lesson\\\/function-parameters\\\/\",\"url\":\"https:\\\/\\\/gigz.pk\\\/python\\\/lesson\\\/function-parameters\\\/\",\"name\":\"Function Parameters - One Language. Endless Possibilities\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/python\\\/#website\"},\"datePublished\":\"2026-03-01T10:56:27+00:00\",\"dateModified\":\"2026-03-13T05:32:42+00:00\",\"description\":\"Learn Python function parameters: use positional, keyword, default, *args, **kwargs to write flexible and reusable functions.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/python\\\/lesson\\\/function-parameters\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/gigz.pk\\\/python\\\/lesson\\\/function-parameters\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/python\\\/lesson\\\/function-parameters\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/gigz.pk\\\/python\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PYTHON FUNDAMENTALS (PYF) > Functions > Function Parameters\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/python\\\/#website\",\"url\":\"https:\\\/\\\/gigz.pk\\\/python\\\/\",\"name\":\"One Language. Endless Possibilities\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/gigz.pk\\\/python\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Function Parameters - One Language. Endless Possibilities","description":"Learn Python function parameters: use positional, keyword, default, *args, **kwargs to write flexible and reusable functions.","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:\/\/gigz.pk\/python\/lesson\/function-parameters\/","og_locale":"en_US","og_type":"article","og_title":"Function Parameters - One Language. Endless Possibilities","og_description":"Learn Python function parameters: use positional, keyword, default, *args, **kwargs to write flexible and reusable functions.","og_url":"https:\/\/gigz.pk\/python\/lesson\/function-parameters\/","og_site_name":"One Language. Endless Possibilities","article_modified_time":"2026-03-13T05:32:42+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["WebPage","FAQPage"],"@id":"https:\/\/gigz.pk\/python\/lesson\/function-parameters\/","url":"https:\/\/gigz.pk\/python\/lesson\/function-parameters\/","name":"Function Parameters - One Language. Endless Possibilities","isPartOf":{"@id":"https:\/\/gigz.pk\/python\/#website"},"datePublished":"2026-03-01T10:56:27+00:00","dateModified":"2026-03-13T05:32:42+00:00","description":"Learn Python function parameters: use positional, keyword, default, *args, **kwargs to write flexible and reusable functions.","breadcrumb":{"@id":"https:\/\/gigz.pk\/python\/lesson\/function-parameters\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/gigz.pk\/python\/lesson\/function-parameters\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/gigz.pk\/python\/lesson\/function-parameters\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/gigz.pk\/python\/"},{"@type":"ListItem","position":2,"name":"PYTHON FUNDAMENTALS (PYF) > Functions > Function Parameters"}]},{"@type":"WebSite","@id":"https:\/\/gigz.pk\/python\/#website","url":"https:\/\/gigz.pk\/python\/","name":"One Language. Endless Possibilities","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/gigz.pk\/python\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/gigz.pk\/python\/wp-json\/wp\/v2\/lesson\/64","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gigz.pk\/python\/wp-json\/wp\/v2\/lesson"}],"about":[{"href":"https:\/\/gigz.pk\/python\/wp-json\/wp\/v2\/types\/lesson"}],"wp:attachment":[{"href":"https:\/\/gigz.pk\/python\/wp-json\/wp\/v2\/media?parent=64"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}