“Argumenty funkcji Pythona” Kod odpowiedzi

Python funkcja jako argument

def sum(a,b):
    return a+b

def calculate(function,a,b):
    return function(a,b)

calculate(sum,3,4)
#returns 7
AartvB

Argumenty Pythona

import sys

print ("the script has the name %s" % (sys.argv[0])
Common Melba Finch

Argumenty funkcji Pythona

def greet(name, msg):
    """This function greets to
    the person with the provided message"""
    print("Hello", name + ', ' + msg)

greet("Monica", "Good morning!")
SAMER SAEID

Odpowiedzi podobne do “Argumenty funkcji Pythona”

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu