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
Conectează-te pentru a vedea istoricul soluțiilor trimise
Conectează-teConectează-te pentru a folosi Mentorul AI
Conectează-teVisible tests
1
Input
[10,20,226]Expected
True2
Input
[0]Expected
True3
Input
[1,2,3]Expected
False4
Input
[255,1]Expected
True5
Input
[100,100,56]Expected
True6
Input
[100,100,55]Expected
FalseFocus radio
Paused · SomaFM · Fluid