Avoid these Gotchas/Errors related to parameters and arguments in Python

Avoid these Gotchas/Errors related to parameters and arguments in Python

Avoid these Gotchas/Errors related to parameters and arguments in Python - before moving on, let’s discuss a few terms. Check out the code snippet below. It’s a simple function that prints the sum of its parameters. In the above function definition for func, a couple of…

We will discuss a couple of Errors and One Gotcha related to Python arguments and parameters.

Before moving on, let’s discuss a few terms. Check out the code snippet below. It’s a simple function that prints the sum of its parameters.

Code Snippet

  • Parameters- They are the names listed in the function’s definition. Eg: In the above code snippet, num1 and num2 are parameters
  • Arguments- They are the values we pass while calling the function. Eg: In the above code snippet, in both calls to the function 10 and 12 are arguments passed to the function
  • Positional Argument- When we pass arguments to a function without explicitly assigning them to parameters. Eg: In the above code snippet, we use positional arguments in the first call to func
  • Keyword Argument- When we pass arguments to a function by explicitly assigning them to parameters. Eg: In the above code snippet, we use keyword arguments in the second call to func
  • Default Values- The value assigned to the parameter during the function definition. Eg: In the above code snippet, 20 is a default value assigned to the parameter num2

coding python-programming python programming python3

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

top 30 Python Tips and Tricks for Beginners

In this post, we'll learn top 30 Python Tips and Tricks for Beginners

Generate QR Code using Python — Python Programming — PyShark

This article will explore how to generate QR code in Python and some useful creation features from pyqrcode library. QR codes recently became more popular than ever before, yet few people know that the first iterations of QR codes were created back in 1990s in Japan for the automotive industry.

Python Programming: A Beginner’s Guide

Python is an interpreted, high-level, powerful general-purpose programming language. You may ask, Python’s a snake right? and Why is this programming language named after it?

Python Tricks Every Developer Should Know

In this tutorial, you’re going to learn a variety of Python tricks that you can use to write your Python code in a more readable and efficient way like a pro.

Guide to Python Programming Language

Guide to Python Programming Language