Byte Checksum Check

In binary protocols, a checksum helps detect whether data was damaged during transfer. Given a list packet, the last byte is already included in the total as the checksum byte. Return True if the sum of all bytes modulo 256 is equal to 0. Otherwise, return False.

Примеры

Ввод
[10, 20, 226]
Вывод
True
Ввод
[0]
Вывод
True
Ввод
[1, 2, 3]
Вывод
False

Нужно реализовать

def checksum_ok(packet):

Теги

arraylistsmath
PostgreSQLv16

Tutaj pojawi się wynik wykonania kodu

Tests12
Visible tests
Ukryty test 7
Ukryty test 8
Ukryty test 9
Ukryty test 10
Ukryty test 11
Ukryty test 12

They run when you press "Submit" — your whole solution is checked against them so you can't hard-code answers for the visible cases.

Focus radio
Paused · SomaFM · Fluid