Ana sayfa
/
Teknoloji
/
What will the following code output? def add (a,b=5) : return a+b print(add(3 ) ) error 3 none 8

Soru

What will the following code output?
def add (a,b=5) :
return a+b
print(add(3 ) )
error
3
none
8

What will the following code output? def add (a,b=5) : return a+b print(add(3 ) ) error 3 none 8

Çözüm

3.6198 Voting
avatar
Gülizar
Usta · 5 yıl öğretmeni
Uzman doğrulaması

Cevap

The8". The function `add` takes two arguments, `a` and `b`, with `b` having a default value of 5. When the function is called with one argument, `3`, the default value of `b` is used, so the function returns `3 + 5`, which is 8.
Derecelendirmek için tıklayın: