function
-
[Python tutorial] 19. Built-in Function코딩/Python 2022. 12. 21. 17:18
abs(n) Returns the absolute value of a number x = abs(-7.25) all(iterable) Returns True if all items in an iterable object are true mylist = [True, True, True] x = all(mylist) any(iterable) Returns True if any item in an iterable object is true mylist = [False, True, False] x = any(mylist) ascii(object) Returns a readable version of an object. Replaces none-ascii characters with escape character..
-
[Python tutorial] 14. Functions코딩/Python 2022. 12. 21. 17:15
Functions def my_function(): print("Hello from a function") my_function() # call a function Arguments (args) def my_function(fname): print(fname + " Refsnes") my_function("Emil") Number of Arguments def my_function(fname, lname): # 2 args print(fname + " " + lname) my_function("Emil", "Refsnes") # 2 args Arbitrary Arguments, *args tuple of args def my_function(*kids): print("The youngest child i..