This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
print("-------歡迎來到剪刀石頭布!-------") | |
name = input("請輸入您的名稱:") | |
# 記錄玩家贏、輸、平手次數 | |
scores = [0,0,0] | |
# 玩家出拳 | |
for i in range(1, 4): | |
while True: | |
user_hand = input("請出拳 (1) 剪刀 (2) 石頭 (3) 布:") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
print("-------歡迎來到剪刀石頭布!-------") | |
name = input("請輸入您的名稱:") | |
win = 0 | |
lose = 0 | |
draw = 0 | |
for i in range(1, 4): | |
# 玩家出拳,防呆機制 | |
while True: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
start = int(input("請輸入起點:")) | |
end = int(input("請輸入結束點:")) | |
total = (start + end) * (end - start + 1) / 2 | |
print(total) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import randint | |
print("-------歡迎來到剪刀石頭布!-------") | |
name = input("請輸入您的名稱:") | |
# 記錄玩家勝利、電腦勝利、和平手的次數 | |
user_score = 0 | |
comp_score = 0 | |
draw = 0 | |
# 將出拳、判斷輸贏重複執行三次 | |
for i in range(1, 4): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import randint | |
print("-------歡迎來到剪刀石頭布!-------") | |
name = input("請輸入您的名稱:") | |
while True: | |
# 記錄玩家與電腦勝利次數 | |
winners = { | |
"player": 0, | |
"computer": 0, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
a = int(input()) | |
b = int(input()) | |
total = 0 | |
for i in range(a, b + 1): | |
total += i | |
print(total) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from random import randint | |
print("-------歡迎來到剪刀石頭布!-------") | |
name = input("請輸入您的名稱:") | |
user_score = 0 | |
comp_score = 0 | |
draw = 0 | |
for i in range(1, 4): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
print("-------歡迎來到剪刀石頭布!-------") | |
name = input("請輸入您的名稱:") | |
# 玩家出拳 | |
user_hand = int(input("請出拳 (1) 剪刀 (2) 石頭 (3) 布:")) | |
# 電腦出拳 | |
comp_hand = random.randint(1,3) | |
# 判斷玩家是贏還是輸 | |
if user_hand == comp_hand: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub CalculateCorr4() | |
Dim corrSheet As Worksheet | |
Set corrSheet = Worksheets("相關性分析") | |
Dim portSheet As Worksheet | |
Set portSheet = Worksheets("投資組合報酬分析") | |
Dim corr As Double | |
Dim i As Integer | |
Dim j as Integer | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub CalculateReturnValue() | |
Dim i As Integer | |
Dim j As Integer | |
For j = 3 To 7 Step 2 | |
For i = 3 To 24 | |
Cells(i, j).Value = (Cells(i, j - 1).Value - Cells(i - 1, j - 1).Value) / Cells(i - 1, j - 1).Value | |
Next i | |
Next j |
NewerOlder