我正在制作一个简单的基于文本的游戏,但出现错误。我必须将代码中的 int 转换为 str。我的代码如下所示:
tax1 = input("You May Now Tax Your City. Will You? ")
if tax1 == "Yes" or tax1 == "yes":
tax2 = input("How Much Will You Tax Per Person In Dollars? ")
if tax2 > 3:
print("You Taxed To High! People Are Moving Out")
time.sleep(1.5)
population -= (random.randint(2, 4))
print("The Population Is Now " + str(population))
time.sleep(1.5)
money += (population * 2)
print("From The Rent You Now Have $" + str(money) + " In Total.")
if tax2 < 3:
print("You Have Placed A Tax That Citizens Are Fine With.")
time.sleep(1.5)
money += (tax2+(population * 2))
print("From The Rent And Tax You Now Have $" + str(money) + " In Total")
我将在我的代码中添加什么来做到这一点?