代码运行正常,尽管我需要将其减少到只有两个小数点,例如 38374.96 而不是 38374.967777777
#!/usr/bin/python3
amount = float(input("Enter a starting value: "))
result = {}
# looping for 10 times
for i in range(1,11):
# updating amount
amount = amount * 1.01
# updating result
result[str(i) + " years"] = amount
# printing result
print(result)