PYPROGLIB Telegram 6596
🕵️ Играем в ревью: сможете найти все 5 багов?

Быстрая проверка скиллов. В этом кусочке кода спрятаны 5 ошибок.

Цель программы: для каждого числа в списке определить, является ли оно простым (prime), и вернуть список булевых значений.

def is_prime(n):
if n <= 1:
return False

for i in range(2, n//2):
if n % i == 0:
return False
return True

def check_primes(numbers):
result = []
for num in numbers:
result.append(is_prime(num))
return result

nums = [0, 1, 2, 3, 4, 5, 10, 11, 13, 15, 17, 19]
print(check_primes(nums))


Вывод сейчас:
[False, False, True, True, True, True, False, True, True, False, True, True]


🎯 Ваша задача — найти все 5 ошибок. Пишите свои ответы в комментариях — обсудим вместе!

👀 Ответ выложу позже.

P.S. Инструкция о том, как оставить комментарий

Библиотека питониста #развлекалово
Please open Telegram to view this post
VIEW IN TELEGRAM
👍64❤‍🔥1🥱1



tgoop.com/pyproglib/6596
Create:
Last Update:

🕵️ Играем в ревью: сможете найти все 5 багов?

Быстрая проверка скиллов. В этом кусочке кода спрятаны 5 ошибок.

Цель программы: для каждого числа в списке определить, является ли оно простым (prime), и вернуть список булевых значений.

def is_prime(n):
if n <= 1:
return False

for i in range(2, n//2):
if n % i == 0:
return False
return True

def check_primes(numbers):
result = []
for num in numbers:
result.append(is_prime(num))
return result

nums = [0, 1, 2, 3, 4, 5, 10, 11, 13, 15, 17, 19]
print(check_primes(nums))


Вывод сейчас:
[False, False, True, True, True, True, False, True, True, False, True, True]


🎯 Ваша задача — найти все 5 ошибок. Пишите свои ответы в комментариях — обсудим вместе!

👀 Ответ выложу позже.

P.S. Инструкция о том, как оставить комментарий

Библиотека питониста #развлекалово

BY Библиотека питониста | Python, Django, Flask




Share with your friend now:
tgoop.com/pyproglib/6596

View MORE
Open in Telegram


Telegram News

Date: |

During a meeting with the president of the Supreme Electoral Court (TSE) on June 6, Telegram's Vice President Ilya Perekopsky announced the initiatives. According to the executive, Brazil is the first country in the world where Telegram is introducing the features, which could be expanded to other countries facing threats to democracy through the dissemination of false content. Some Telegram Channels content management tips As five out of seven counts were serious, Hui sentenced Ng to six years and six months in jail. To delete a channel with over 1,000 subscribers, you need to contact user support 1What is Telegram Channels?
from us


Telegram Библиотека питониста | Python, Django, Flask
FROM American