Skip to content

Commit 4da308d

Browse files
committed
format
1 parent ed8deb1 commit 4da308d

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

python/10-user_defined_functions.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ After defining the function name and arguments(s) a block of program statement(s
88
Here is the syntax of a user defined function.
99

1010
## Syntax
11-
```
11+
```python
1212
def function_name(argument1, argument2, ...) :
1313
statement_1
1414
statement_2
@@ -19,11 +19,11 @@ def function_name(argument1, argument2, ...) :
1919
Calling a function in Python is similar to other programming languages, using the function name, parenthesis (opening and closing) and parameter(s). See the syntax, followed by an example.
2020

2121
### Syntax
22-
```
22+
```python
2323
function_name(arg1, arg2)
2424
```
2525
### Example :
26-
```
26+
```python
2727
def avg_number(x, y):
2828
print("Average of ",x," and ",y, " is ",(x+y)/2)
2929
avg_number(3, 4)
@@ -42,15 +42,15 @@ Average of 3 and 4 is 3.5
4242
## Function without arguments :
4343

4444
The following function has no arguments.
45-
```
45+
```python
4646
def function_name() :
4747
statement_1
4848
statement_2
4949
....
5050
```
5151
### Example :
5252

53-
```
53+
```python
5454
def printt():
5555
print("I Love CodeCell")
5656
print("I Love CodeCell")
@@ -73,7 +73,7 @@ I Love CodeCell
7373
## The Return statement in function
7474

7575
In Python the return statement (the word return followed by an expression.) is used to return a value from a function, return statement without an expression argument returns none. See the syntax.
76-
```
76+
```python
7777
def function_name(argument1, argument2, ...) :
7878
statement_1
7979
statement_2
@@ -85,7 +85,7 @@ function_name(arg1, arg2)
8585
### Example :
8686

8787
The following function returns the square of the sum of two numbers.
88-
```
88+
```python
8989
def nsquare(x, y):
9090
return (x*x + 2*x*y + y*y)
9191
print("The square of the sum of 2 and 3 is : ", nsquare(2, 3))

0 commit comments

Comments
 (0)