python每周⼀练:⼈⽣模拟器(⼀)
import random
import time
point = {'beauty': 0, 'intelligence': 0, 'background':0, 'physique':0}
hidden_point = {'happiness':0, 'luck':0}
point_list = [0,0,0,0]
hidden_point_list = [0,0]
total_point = 30
while True:
print("----------beauty:{}----------".format(point_list[0]))
print("-------intelligence:{}-------".format(point_list[1]))
print("--------background:{}--------".format(point_list[2]))
print("---------physique:{}---------".format(point_list[3]))
process = input("Action(add point/remove point/confirm/random distribution): ")
if process == "add point":
print("You have {} points to spend, choose which you want to add on.".format(total_point))
choose = input("beauty/intelligence/background/physique: ")
choP = int(input("points you want to add on: "))
if choP <= total_point:
if choose == "beauty":
point_list[0] += choP
total_point -= choP
elif choose == "intelligence":
point_list[1] += choP
total_point -= choP
elif choose == "background":
point_list[2] += choP
total_point -= choP
elif choose == "physique":
point_list[3] += choP
total_point -= choP
else:
raise RuntimeError('what do you think you are typing in?')
else:
raise RuntimeError('Do some grade one math before you type in!')
elif process == "remove point":
print("Choose which you want to remove from.")
choose = input("beauty/intelligence/background/physique: ")
choP = int(input("points you want to remove from: "))
if choose == "beauty":
if choP<= point_list[0]:
point_list[0] -= choP
total_point += choP
else:
raise RuntimeError('Do some grade one math before you type in!')
elif choose == "intelligence":
if choP<=point_list[1]:
point_list[1] -= choP
total_point += choP
else:
raise RuntimeError('Do some grade one math before you type in!')
elif choose == "background":
if choP<=point_list[2]:
point_list[2] -= choP
total_point += choP
else:
raise RuntimeError('Do some grade one math before you type in!')
elif choose == "physique":
python新手代码你好if choP<=point_list[3]:
point_list[3] -= choP
point_list[3] -= choP
total_point += choP
else:
raise RuntimeError('Do some grade one math before you type in!')
else:
raise RuntimeError('what do you think you are typing in?')
elif process == "confirm":
if total_point == 0:
print("points used. \nbeauty:{}, intelligence:{}, background:{}, physique:{}. \nLife simulator initialized.".format(point_list[0],point_list[1],point_list[2],point_list[            break
else:
print("Still have points that are not used.")

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。