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
Inicia sesión para ver tu historial de envíos
Iniciar sesiónInicia sesión para usar el AI Mentor
Iniciar sesiónTests12
Visible tests
Prueba oculta 7
Prueba oculta 8
Prueba oculta 9
Prueba oculta 10
Prueba oculta 11
Prueba oculta 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