Telegram Group & Telegram Channel
Что выведет следующий код на Python (модуль statistics)?


import statistics as stats
import math

data = [1, 2, 2, float('nan'), 3, 4]

print("Mean:", stats.mean(data))
print("Median:", stats.median(data))
print("Mode:", stats.mode(data))


🔢 Варианты ответа:

A)

Median: 2.5
Mode: 2


B)

Median: 2.5
Mode: 2


C)ValueError: nan is not a valid number


D)

Median: nan
Mode: 2


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

💡 Почему?
- Модуль
statistics не умеет работать с NaN.
-
stats.mean() и stats.median() вызовут StatisticsError или ValueError.
- В отличие от
numpy.nanmean, здесь всё падает.
📌 Подвох — в
float('nan') в списке.



group-telegram.com/machinelearning_interview/1731
Create:
Last Update:

Что выведет следующий код на Python (модуль statistics)?


import statistics as stats
import math

data = [1, 2, 2, float('nan'), 3, 4]

print("Mean:", stats.mean(data))
print("Median:", stats.median(data))
print("Mode:", stats.mode(data))


🔢 Варианты ответа:

A)

Median: 2.5
Mode: 2


B)

Median: 2.5
Mode: 2


C)ValueError: nan is not a valid number


D)

Median: nan
Mode: 2


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

💡 Почему?
- Модуль
statistics не умеет работать с NaN.
-
stats.mean() и stats.median() вызовут StatisticsError или ValueError.
- В отличие от
numpy.nanmean, здесь всё падает.
📌 Подвох — в
float('nan') в списке.

BY Machine learning Interview


Warning: Undefined variable $i in /var/www/group-telegram/post.php on line 260

Share with your friend now:
group-telegram.com/machinelearning_interview/1731

View MORE
Open in Telegram


Telegram | DID YOU KNOW?

Date: |

Although some channels have been removed, the curation process is considered opaque and insufficient by analysts. In December 2021, Sebi officials had conducted a search and seizure operation at the premises of certain persons carrying out similar manipulative activities through Telegram channels. Ukrainian President Volodymyr Zelensky said in a video message on Tuesday that Ukrainian forces "destroy the invaders wherever we can." Asked about its stance on disinformation, Telegram spokesperson Remi Vaughn told AFP: "As noted by our CEO, the sheer volume of information being shared on channels makes it extremely difficult to verify, so it's important that users double-check what they read." During the operations, Sebi officials seized various records and documents, including 34 mobile phones, six laptops, four desktops, four tablets, two hard drive disks and one pen drive from the custody of these persons.
from us


Telegram Machine learning Interview
FROM American