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ă-teTests12
Visible tests
Test ascuns 7
Test ascuns 8
Test ascuns 9
Test ascuns 10
Test ascuns 11
Test ascuns 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