Created
March 15, 2023 13:50
-
-
Save MaxDefense/404e25bdb5f06e1b3331717f0562ae9d to your computer and use it in GitHub Desktop.
Callback a function with arguments in python 3.8.10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! callback - function transmitted as a parameter of another function | |
# // def first(x): | |
# // print('- first function works') | |
# // x() | |
def first(x, *args): | |
print('- first function works') | |
x(*args) | |
def second(): | |
print('- second function works') | |
# first(second) | |
def third(*args): | |
print(f'- result of the third function: {sum(args)}') | |
# first(third, 2, 6) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment