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: |

Traders also expressed uncertainty about the situation with China Evergrande, as the indebted property company has not provided clarification about a key interest payment.In economic news, the Commerce Department reported an unexpected increase in U.S. new home sales in August.Crude oil prices climbed Friday and front-month WTI oil futures contracts saw gains for a fifth straight week amid tighter supplies. West Texas Intermediate Crude oil futures for November rose $0.68 or 0.9 percent at 73.98 a barrel. WTI Crude futures gained 2.8 percent for the week.

That growth environment will include rising inflation and interest rates. Those upward shifts naturally accompany healthy growth periods as the demand for resources, products and services rise. Importantly, the Federal Reserve has laid out the rationale for not interfering with that natural growth transition.It's not exactly a fad, but there is a widespread willingness to pay up for a growth story. Classic fundamental analysis takes a back seat. Even negative earnings are ignored. In fact, positive earnings seem to be a limiting measure, producing the question, "Is that all you've got?" The preference is a vision of untold riches when the exciting story plays out as expected.

telegram from ye


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