what is arguments in python

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MyrinNew
    Senior Member
    • Feb 2024
    • 5175

    #1

    what is arguments in python

    Arguments:

    In Python, an argument is a value passed to a function when it's called, allowing the function to perform different actions or operations based on the input.

    *Function Definition: When you define a function, you might specify parameters (variables) that the function will use.

    *Function Call: When you call the function, you provide values for those parameters, and these values are called arguments.


    Types of arguments:

    *Positional Arguments: Arguments passed in the order they are defined in the function.

    *Keyword Arguments: Arguments passed with the parameter name (e.g., greet(name="Bob")).

    *Default Arguments: Arguments with default values that are optional during the function call.

    *Variable-Length Arguments: Arguments that allow functions to accept a variable number of arguments (using *args and **kwargs).


    What are the argument in parameters:

    In programming, parameters are placeholders defined in a function's signature, while arguments are the actual values passed to the function when it's called.




    ---------------------x-----------------------





    2/4/25

    In python,variable is an object is it so? In python,everything is an object python is strongly object oriented programming language.

    pointers in c


    object represent class.

    object is sample of class.

    object is instance of class.


    object cannot be present without class-True/false =True

    class can be present without object - True/false =True


    python is dynamically typed programming language.


    name='salman'

    age=25

    height=5.6


    amount=10000

    intrest=7.5

    months=12


    print((int)(amount*intrest*months))920000.6776

    no=121212222222222

    print=(no)


    *print add(no1.no2):

    print(no1+no2)

    *print sub(no1,no2)

    print(no1-no2)

    *print multi(no1,no2)

    print(no1*no2)

    *print div(no1,no2)

    print(no1/no2)

    *print modulo div(no1,no2(

    print(no1%no2)


    def----->definition

    add----->function name

    no1,no2->arguments/parameters

    arguments/parameters

    #input given a function.


    function calling

    add(10,20)

    sub(100,50)

    multiply(2,3)




    More...
Working...