Skip to content

Commit fce2118

Browse files
function (#140)
* add a french documentation * modify a function * Delete README.fr.md * Update function.py * Update function.py * Update function.py --------- Co-authored-by: Samuel Huang <samhuang91@gmail.com>
1 parent 96fb844 commit fce2118

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

ultimatepython/syntax/function.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,16 @@ def sum_until(fn, n):
3333
return total
3434

3535

36+
def without_parameters():
37+
"""A function that does not accept parameters and does not return a value."""
38+
pass
39+
40+
41+
def sum(x: int, y: int) -> int:
42+
"""A function that accepts parameters and has type hints."""
43+
return x + y
44+
45+
3646
def main():
3747
# The `add` function can be used for numbers as expected
3848
add_result_int = add(1, 2)
@@ -54,6 +64,10 @@ def main():
5464
# attribute! Remember this - everything in Python is an object
5565
assert "includes this docstring!" in sum_until.__doc__
5666

67+
# Call a few more functions to show that they are valid
68+
assert without_parameters() is None
69+
assert sum(1, 2) == 3
70+
5771

5872
if __name__ == "__main__":
5973
main()

0 commit comments

Comments
 (0)