def greet(word, times): for _ in range(times-1): print(f"{word}、", end="") print(f"{word}!") return w = input("あいさつ?") n = int(input("何回?")) greet(w, n) # プログラム7-6(あいさつを繰り返す)