import random
# for
# print 1~10
print("For Loop")
for i in range(1, 11):
print(f"{i}")
# Multiplication Table
for i in range(1, 10):
for j in range(1, 10):
print(f"{i} * {j} = {i * j}")
result = 0
for i in range(1, 11):
result += i
print(result)
# while
# print 1~10
print("While Loop")
count = 1
while count <= 10:
print(f"{count}")
count += 1
# Multiplication Table
x = 1
y = 1
while x <= 9:
while y <= 9:
print(f"{x} * {y} = {x * y}")
y += 1
x += 1
y = 1
result = 0
count = 1
while count <= 10:
result += count
count += 1
print(result)
# Guess Number, and hint too High or Low
random_num = random.randint(1, 100)
print(random_num)
while True:
number = int(input("Guess Number:"))
if number > random_num:
print(f"{number} too High")
else:
print(f"{number} too Low")
if number == random_num:
print(f"number:{number} Hit random:{random_num}")
break
# print square
squares = [i**2 for i in range(1, 11)]
print(squares)
# for + dictionary
student_scores = {"Alice": 85, "Bob": 90, "Charlie": 75}
for name, score in student_scores.items():
print(f"{name} scored {score}")
# for + zip
fruits = ["Apple", "Banana", "Orange"]
amount = [10, 20, 30]
for fruits, amount in zip(fruits, amount):
print(f"fruits:{fruits}, amount:{amount}")
|
Luke 發表在 痞客邦 留言(0) 人氣(15)

為了呈現程式碼安裝,然後因為目前不熟HTML 語法,只能找https://snippet-formatter.vercel.app/ 幫我轉換成能上色的程式碼
Luke 發表在 痞客邦 留言(0) 人氣(15)

目前看起來Python好多功能
建立一個程式,讓使用者輸入名字和年齡。多嘗試了一些python語法
Luke 發表在 痞客邦 留言(0) 人氣(17)
print() 函數功能:將資料輸出到標準輸出(通常是控制台)。語法:print(*objects, sep=' ', end='\n', file=sys.stdout, flush=False)
*objects:要輸出的資料,可以是多個不同的變數或值。
sep:設定多個輸出項之間的分隔符,預設為空格。
end:設定每次輸出結尾的符號,預設為換行符 \n。
file:指定輸出目標,預設為 sys.stdout(控制台),但可以輸出到文件。
flush:是否強制刷新輸出,預設為 False。
Luke 發表在 痞客邦 留言(0) 人氣(20)
Luke 發表在 痞客邦 留言(0) 人氣(19)
Luke 發表在 痞客邦 留言(0) 人氣(21)

台股最近從8500反彈
一開始不太敢進場😂一方面受限於之前的想法(應該會打第二隻腳)
Luke 發表在 痞客邦 留言(0) 人氣(20)

財報分析
獲利性分析 包括: 毛利率、營益率、淨利率、股東權益報酬率
安全性分析
價值評估 本益比、股價淨值比、股利折現率
成長性分析
Luke 發表在 痞客邦 留言(0) 人氣(24)
Luke 發表在 痞客邦 留言(0) 人氣(19)