だから私はここに何かが欠けています。ユーザーが持っているすべてのポイントを使い果たし、さらにポイントをプールに追加するかどうかを尋ねるプロンプトが表示され、ユーザーが「n」を選択すると、プールにさらにポイントを追加するように継続的にプロンプトが表示されます。これは起こるべきではありません。ブレークの配置をいじってみましたが、役に立ちませんでした。ユーザーが「n」を入力すると、ループ全体が停止します。どんな助けでも大歓迎です。ありがとう。
# Char Creator- pool of 30 pts, spend on Str, Health, Wisdom, Dex
# Spend points in pool on attr, take points and put them back into pool
pool = 30
attr = {'Strength' : 0, 'Health' : 0, 'Wisdom' : 0, 'Dexterity' : 0}
while True:
while pool > 0:
print('\t\t Time to spend some points! You have', pool, 'to spend')
spend = input('Where would you like to spend your points?')
if spend in attr:
amount = int(input('How many points would you like to spend?'))
if amount > pool:
print('You do not have that many points! You have', pool, 'points!')
else:
attr[spend] += amount
pool -= amount
print(attr)
else:
print('Not a valid input. Please correct.')
print('\t\t You have no more points! Add some to the pool!')
while pool == 0:
confirm = input('Would you like to add points back into the pool?')
if confirm == 'y':
take = input('Where would you like to take points from?')
if take in attr:
number = int(input('How many points would you like to take?'))
if attr[take] >= number:
pool += number
attr[take] -= number
print ('There are now', pool, 'points remaining')
elif attr[take] < number:
print('You dont have enough points to do that! You have', attr[take], 'points in', take)
else:
print('Please make a valid selection.')
elif confirm == 'n':
print('Goodbye!')
break