Anasayfa
/
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

Çözüm

3.6 (198 Oylar)
Gülizar
Uzman doğrulaması
Usta · 5 yıl öğretmeni

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.