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
Logi sisse, et näha esituste ajalugu
Logi sisseLogi sisse, et kasutada AI mentorit
Logi sisseTests12
Visible tests
Peidetud test 7
Peidetud test 8
Peidetud test 9
Peidetud test 10
Peidetud test 11
Peidetud 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