Python เบื้องต้นสำหรับการเงิน
Adina Howe
Professor
เก็บข้อมูลที่สามารถอ้างอิงได้ในโค้ด
msft_stock, interest_rate, bondsinterest_rate = 0.05
ชื่อตัวแปร
class หรือ type) ควรหลีกเลี่ยง# Correct
day_2 = 5
# Incorrect, variable name starts with a digit
2_day = 5
$$ \text{Price to earning ratio} = \frac{\text{Market price}}{\text{Earnings per share}} $$
price = 200 earnings = 5pe_ratio = price / earningsprint(pe_ratio)
40
Python เบื้องต้นสำหรับการเงิน