“Python pomnóż 2 zmienne” Kod odpowiedzi

Mnożenie dwóch lub więcej liczb w Pythonie

# multiplication of two or more numbers
def multiple(*a):
    result = 1
    for i in a:
        result = result * i
    return result


# insert any number of arguments for multiplication, example:
res = multiple(12, 2, 5)
print(res)
# In this example, code output is = 120
Important Ibis

Python pomnóż 2 zmienne

num1 = "2" # first variable
num2 = "2" # second variable
output = num1*num2 # multiplied number

# Optional: print multiplied number
print(output)
Arrogant Anaconda

Odpowiedzi podobne do “Python pomnóż 2 zmienne”

Pytania podobne do “Python pomnóż 2 zmienne”

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

Przeglądaj inne języki kodu