PYTHON_JOB_INTERVIEW Telegram 1128
🐍 Задача для собеседования на Python

Условие:
def mystery(x, y):
if x == 0:
return y
else:
return mystery(x - 1, x + y)

result = mystery(3, 2)
print(result)

— Вопрос: что будет выведено в результате выполнения этого кода?

Варианты ответов:
А. 5
B. 8
C. 11
D. Ошибка рекурсии

Правильный ответ: B.

Пояснение:
Функция
mystery — это рекурсивная функция, которая накапливает сумму чисел от x до 1, прибавляя y в конце.

@python_job_interview



tgoop.com/python_job_interview/1128
Create:
Last Update:

🐍 Задача для собеседования на Python

Условие:

def mystery(x, y):
if x == 0:
return y
else:
return mystery(x - 1, x + y)

result = mystery(3, 2)
print(result)

— Вопрос: что будет выведено в результате выполнения этого кода?

Варианты ответов:
А. 5
B. 8
C. 11
D. Ошибка рекурсии

Правильный ответ: B.

Пояснение:
Функция
mystery — это рекурсивная функция, которая накапливает сумму чисел от x до 1, прибавляя y в конце.

@python_job_interview

BY Python вопросы с собеседований


Share with your friend now:
tgoop.com/python_job_interview/1128

View MORE
Open in Telegram


Telegram News

Date: |

Telegram is a leading cloud-based instant messages platform. It became popular in recent years for its privacy, speed, voice and video quality, and other unmatched features over its main competitor Whatsapp. Just at this time, Bitcoin and the broader crypto market have dropped to new 2022 lows. The Bitcoin price has tanked 10 percent dropping to $20,000. On the other hand, the altcoin space is witnessing even more brutal correction. Bitcoin has dropped nearly 60 percent year-to-date and more than 70 percent since its all-time high in November 2021. 5Telegram Channel avatar size/dimensions 3How to create a Telegram channel? With the “Bear Market Screaming Therapy Group,” we’ve now transcended language.
from us


Telegram Python вопросы с собеседований
FROM American