Skip to content

Commit cebac37

Browse files
modify a function
1 parent 514610f commit cebac37

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

ultimatepython/syntax/function.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,21 @@
55
in an interesting way.
66
"""
77

8+
def without_parameters():
9+
"""A function that does not accept parameters and does not return a value.
10+
11+
This function is not used in this module, but it is defined to illustrate
12+
that functions do not need to accept parameters or return values.
13+
"""
14+
print("This function does not accept parameters or return a value.")
15+
def sum(x: int, y: int) -> int:
16+
"""A function that accepts parameters and has type hints.
17+
18+
This function is not used in this module, but it is defined to illustrate
19+
that functions can accept parameters and have type hints.
20+
"""
21+
22+
return x + y
823

924
def add(x, y):
1025
"""Add two objects together to produce a new object.
@@ -55,6 +70,11 @@ def main():
5570
# attribute! Remember this - everything in Python is an object
5671
assert "includes this docstring!" in sum_until.__doc__
5772

73+
# Call the other two functions to ensure they work as expected
74+
75+
assert without_parameters() is None
76+
assert sum(1, 2) == 3
77+
5878

5979
if __name__ == "__main__":
6080
main()

0 commit comments

Comments
 (0)