Python训练营Day1
@浙大疏锦行Python训练营Day1
内容:
- 格式化输出
- 变量命名
- Python debugger
# question 1
a = str(1)
b = str(2)
c = str(3)
print(a + "\n" + b + "\n" + c)# Question 2
name = "xiaoming"
city = "beijing"
print(f"name :\"{name}\", city: {city}")# Question 3.1
num1 = 20
num2 = 8
a = num1 + num2
b = num1 / num2
c = num1 % num2
print(f"num1 + num2 is {a}")
print(f"num1 / num2 is {b}")
print(f"num1 % num2 is {c}")
# Question 3.2
price = 19.9
discount = 0.8 # 8折
final_price = price * discount
saved_amount = price - final_price
print(f"最终价格是:{final_price} \n节省金额是:{saved_amount}")