1

Im VERY new to programming. Its my second day. In functions like file.read(), empty parenthesis are part of the syntax. Are they always supposed to be empty, or is there an option to fill them? My script works fine, It's just a question I've always had.

0

2 Answers 2

2

When you define a function, you specify the function's arguments. A function can have zero or more arguments. When a function has zero arguments, or all of its arguments have default values, then you can call the function without passing any arguments.

Sign up to request clarification or add additional context in comments.

Comments

0

It depends whether you what them empty (no arguments ) or not (with arguments)

Here is an example of a function

#Let's create a function that can add two values :) def add(x, y): # the function have positional arguments 'x' 'y' z = x + y return z # the function output the value of z addition = add(5, 33) # call the add() function with arrguments x=5, y=33 print(addition) #this time variables as arguments a = 5 b = 33 additon = add(a ,b) print(addition) 

As you can see above that function takes input as arguments and returns the output

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.