こんな感じでどうでしょうか?↓
import random
def shuffle_seats():
seats = list(range(1, 41))
random.shuffle(seats)
index = 0
for row in range(5):
for col in range(8):
print(f\u0026quot;{seats[index]:2}\u0026quot;, end=\u0026quot; \u0026quot;)
index += 1
print()
shuffle_seats()