def joinString(array):
return ' '.join([str(elem) for elem in array])
sticks = list(13 * "|")
sticks_remaining = joinString(sticks)
print(f' {sticks_remaining} sticks remaining')
player = print("You may pickup between 1 to 4")
pickup = input("How many sticks do you want to pickup?:\n")
del sticks[0:int(pickup)]
remSticks = joinString(sticks)
print(f'{remSticks} sticks remaining')
1条答案
按热度按时间yjghlzjz1#
我认为我们可以将sticks字符串推到array中,并根据输入选择删除元素。