diff --git a/src/calibre/ebooks/lrf/html/table.py b/src/calibre/ebooks/lrf/html/table.py
index 1d165c22e6..137f76ddc4 100644
--- a/src/calibre/ebooks/lrf/html/table.py
+++ b/src/calibre/ebooks/lrf/html/table.py
@@ -288,10 +288,10 @@ class Table:
conv.in_table = False
def number_of_columns(self):
- max = 0
+ val = 0
for row in self.rows:
- max = row.number_of_cells() if row.number_of_cells() > max else max
- return max
+ val = max(val, row.number_of_cells())
+ return val
def number_or_rows(self):
return len(self.rows)