Telegram Group & Telegram Channel
Что выведет этот код и почему?

❗️ Ответ: 6. Объяснение:

1. В функции outer_func создается x со значением 2.

2. Следом объявляется функция inner_func, она не запоминает значение x или y сразу, а получит его только при ее использовании.

3. x становится равен x + 2, т.е. 4, объявляется y со значением 2

4. выполняется блок return (x(4) + y(2) = 6).

5. Несмотря на объявление значения y = 3, функция inner_func будет вызвана только после возвращения значения y = 2. Поэтому вывод будет равен 6.



@python_job_interview
Please open Telegram to view this post
VIEW IN TELEGRAM



tg-me.com/python_job_interview/948
Create:
Last Update:

Что выведет этот код и почему?

❗️ Ответ: 6. Объяснение:

1. В функции outer_func создается x со значением 2.

2. Следом объявляется функция inner_func, она не запоминает значение x или y сразу, а получит его только при ее использовании.

3. x становится равен x + 2, т.е. 4, объявляется y со значением 2

4. выполняется блок return (x(4) + y(2) = 6).

5. Несмотря на объявление значения y = 3, функция inner_func будет вызвана только после возвращения значения y = 2. Поэтому вывод будет равен 6.



@python_job_interview

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




Share with your friend now:
tg-me.com/python_job_interview/948

View MORE
Open in Telegram


telegram Telegram | DID YOU KNOW?

Date: |

The S&P 500 slumped 1.8% on Monday and Tuesday, thanks to China Evergrande, the Chinese property company that looks like it is ready to default on its more-than $300 billion in debt. Cries of the next Lehman Brothers—or maybe the next Silverado?—echoed through the canyons of Wall Street as investors prepared for the worst.

A project of our size needs at least a few hundred million dollars per year to keep going,” Mr. Durov wrote in his public channel on Telegram late last year. “While doing that, we will remain independent and stay true to our values, redefining how a tech company should operate.

telegram from us


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