"""第 21 课补全练习：为四句放入标点。修改 solve，保持下方检查不变。"""
import math, io, argparse
import torch
from torch import nn
from torch.nn import functional as F
torch.set_num_threads(2)
torch.manual_seed(26)

def solve(text, width):
    if width not in (5,7) or len(text)!=4*width: raise ValueError('长度不符')
    return [text[i*width:(i+1)*width]+('，' if i%2==0 else '。') for i in range(4)]

lines=solve('春江花月夜'*4,5)
assert len(lines)==4 and all(len(x)==6 for x in lines)
assert [x[-1] for x in lines]==list('，。，。')
print("本课补全练习通过。")
