The OpenNET Project / Index page

[ новости /+++ | форум | теги | ]



"Mozilla запустила проект Mozilla.ai для развития открытых систем машинного обучения "
Версия для распечатки Пред. тема | След. тема
Форум Разговоры, обсуждение новостей
Исходное сообщение [ Отслеживать ]
Подсказка: Для сортировки сообщений в нити по дате нажмите "Сортировка по времени, UBB".
. "Mozilla запустила проект Mozilla.ai для развития открытых си..." +/
Сообщение от Аноним (68), 28-Мрт-23, 15:58 
> You are a highly skilled computer scientist. You know a lot about error-correcting codes and modern machine learning. You want to write a program in Python programming language solving a typical fizz-buzz task. Do it.

def print_fizzbuzz(n):
    """This function prints the number from 1 up to n, but only if there is no overlap with previous numbers."""
    
    # Initialize counter and current digit of result string  
    count = 0
    currDigit = '0'
      
    while True:
        # Calculate next fizzbuzz value by incrementing the counter, but only if it is not divisible with any previous numbers    
        newNum = n - (n % count)  
          
            # If there was no overlap between current and last number print result string  
        if currDigit != '0' or newNum > 9:
                return f"{currDigit}{newNum}"

Мало того, что это не fizz-buzz, мало того, что типы неправильные, так ещё и

ZeroDivisionError: integer modulo by zero

Ответить | Правка | Наверх | Cообщить модератору

Оглавление
Mozilla запустила проект Mozilla.ai для развития открытых систем машинного обучения , opennews, 23-Мрт-23, 08:20  [смотреть все]
Форумы | Темы | Пред. тема | След. тема



Партнёры:
PostgresPro
Inferno Solutions
Hosting by Hoster.ru
Хостинг:

Закладки на сайте
Проследить за страницей
Created 1996-2024 by Maxim Chirkov
Добавить, Поддержать, Вебмастеру