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

Här visas resultatet av din kod

Tests12
Visible tests
Dolt test 7
Dolt test 8
Dolt test 9
Dolt test 10
Dolt test 11
Dolt 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