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

Telegram announces Search Filters

With the help of the Search Filters option, users can now filter search results by type. They can do that by using the new tabs: Media, Links, Files and others. Searches can be done based on the particular time period like by typing in the date or even “Yesterday”. If users type in the name of a person, group, channel or bot, an extra filter will be applied to the searches.

How Does Bitcoin Mining Work?

Bitcoin mining is the process of adding new transactions to the Bitcoin blockchain. It’s a tough job. People who choose to mine Bitcoin use a process called proof of work, deploying computers in a race to solve mathematical puzzles that verify transactions.To entice miners to keep racing to solve the puzzles and support the overall system, the Bitcoin code rewards miners with new Bitcoins. “This is how new coins are created” and new transactions are added to the blockchain, says Okoro.

telegram from hk


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