python题目:给定利率,求多少年后,本金翻倍。 代码 # 利率 a = float(input("输入你的利率:")) b = 1 year = 0 while(b < 2.0): b *= (a + 1) year += 1 print("结果年数:" + str(year))