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

Why Telegram?

Telegram has no known backdoors and, even though it is come in for criticism for using proprietary encryption methods instead of open-source ones, those have yet to be compromised. While no messaging app can guarantee a 100% impermeable defense against determined attackers, Telegram is vulnerabilities are few and either theoretical or based on spoof files fooling users into actively enabling an attack.

What is Secret Chats of Telegram

Secret Chats are one of the service’s additional security features; it allows messages to be sent with client-to-client encryption. This setup means that, unlike regular messages, these secret messages can only be accessed from the device’s that initiated and accepted the chat. Additionally, Telegram notes that secret chats leave no trace on the company’s services and offer a self-destruct timer.

telegram from tw


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