编程带来的成就感
資深大佬 : jeblur 17
希望多学一门技能,所以最近一直在学习 python,在看《 Python Crash Course 》,其中作者在最开头提到的
“ There is real satisfaction in building something with a purpose, something that solves a problem. ”
今天我算是体会到了,起因是看到一个人在朋友圈晒保险(年年拿钱的那种,可以拿到 105 岁[我惊呆了]),
于是萌生用 python 来看要是买 10w 到底最后能拿到多少钱,
于是有了下面这几行代码,虽然很简单[大佬请忽略]
可是这个小东西带来的成就感可能会是我以后人生所想要追求的
# Define your initial saving amount saving_amount = 100000 # Define the saving rate of your bank saving_rate = 0.04 # Assign an initial value 0 for the following loop year = 0 # Assign a default True value for the following loop flag = True while flag: # Start a loop before a False value is associated to flag if year < 100: saving_amount = saving_amount*(1+saving_rate) year += 1 flag = True else: print(f"You have {saving_amount} in your account.") flag = False
大佬有話說 (16)