世界標準MIT教科書 Python p23

P23 指練習

numXs回だけtoPrintにXを連結する.

numXs = int(input(' How many times should I print the letter X?' ))
toPrint = ''
while (numXs != 0):
    toPrint = toPrint + 'X'
    numXs = numXs - 1
print(toPrint)