def maior_primo(n):
for num in reversed(range(1,n+1)):
if all(num%i!=0 for i in range(2,num)):
return num
print(maior_primo(100)) # 97
ZGVmIG1haW9yX3ByaW1vKG4pOgogICAgZm9yIG51bSBpbiByZXZlcnNlZChyYW5nZSgxLG4rMSkpOgogICAgICAgIGlmIGFsbChudW0laSE9MCBmb3IgaSBpbiByYW5nZSgyLG51bSkpOgogICAgICAgICAgIHJldHVybiBudW0KICAgIApwcmludChtYWlvcl9wcmltbygxMDApKSAjIDk3