Login using Social Account
     Continue with GoogleLogin using your credentials
We can define new custom functions by giving a name and the sequence of statements that execute when the function is called. Once we define a function, we can reuse the function over and over throughout our program. For eg,
def print_name():
name = "Cloudxlab"
print("My name is", name)
It assigns "Cloudxlab" to the variable name
and then prints it.
def
is a keyword that indicates that this is a function definition. The name of the function is print_name
. Try printing the type of print_name
and see the result,
print(type(print_name))
The syntax for calling the new function is the same as for built-in functions:
print_name()
Taking you to the next exercise in seconds...
Want to create exercises like this yourself? Click here.
No hints are availble for this assesment
Answer is not availble for this assesment
Loading comments...