黑馬程序員python教程,8天python從入門到精通,學python看這套就

Day01:
?
第一階段-第二章-03-變量 P16 - 11:44
?
代碼如下:
# Day01 變量練習 money = 50 print("當前錢包余額:", money, "元") # 冰淇淋10元 ice_cream = 10 print("購買冰淇淋,花費:", ice_cream, "元") # 可樂5元 coke = 5 print("購買了可樂,花費:", coke, "元") print("最終,錢包剩余:", money - ice_cream - coke, "元")

?
第一階段-第二章-13-對表達式進... P26 - 07:26
?
代碼如下:
name = "傳智播客" # 公司名 stock_price = 19.99 # 當前股價 stock_code = "003032" # 股票代碼 stock_price_daily_growth_factor = 1.2 # 股票每日增長系數(shù) growth_days = 7 # 增長天數(shù) after_growth_price = stock_price * stock_price_daily_growth_factor ** growth_days # f"{變量}的方式" print(f"公司:{name},股票代碼:{stock_code},當前股價:{stock_price}") # % 占位符的方式 print("每日增長系數(shù)是:%.2f,經(jīng)過%d天的增長后,股價達到了:%.2f" % (stock_price_daily_growth_factor, growth_days, after_growth_price))

?
第一階段-第二章-15-數(shù)據(jù)輸入(input語句) P28 - 09:36
?
代碼如下:
user_name = input("請輸入用戶名:") user_type = input("請輸入用戶類型:") print(f"您好:{user_name},您是尊貴的:{user_type}用戶,歡迎您的光臨!")

標簽: