Click here to Skip to main content
16,017,922 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
so i just learned about argumentative functions and i was told to end a function you put its name and then () but with how argumentative functions work this would not work

What I have tried:

what have you tried? looking it up
Posted
Updated 28-Sep-19 22:01pm
Comments
Visweswaran N 29-Sep-19 1:45am    
Could you please describe briefly what you are trying to achieve and what is going wrong? By far my understating from "unction you put its name and then () " is are you looking for something like recursion?

I think you mean "Function Arguments", rather than "Argumentative Functions" - the latter doesn't exist and implies that the functions prefer to shout at each other rather than do anything useful! :laugh:

Function can have arguments, which are values that you can pass into the function for it to process, or they can have no arguments.
To declare a function with arguments, you write the list after the name:
Python
def doubleIt(number)
   return number + number
And you can then call it with a different value each time:
Python
print(doubleIt(2))
print(doubleIt(666))

If you don't want to pass any values to a function, then you leave the brackets empty:
Python
def showMenu()
   print ("Press 1 for Sales")
   print ("Press 2 for Accounts")
   print ("Press 3 for the operator")
   print ("Press 0 to quit")

There are more details here: Python Functions (def): Definition with Examples[^] and here: Python Function Arguments (Default, Keyword and Arbitrary)[^]
 
Share this answer
 
v2
Comments
CPallini 29-Sep-19 3:57am    
5.
 
Share this answer
 
Comments
CPallini 29-Sep-19 3:57am    
5.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900