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("請輸入您的名稱:") | |
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
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
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
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
import random | |
print("-------歡迎來到剪刀石頭布!-------") | |
name = input("請輸入您的名稱:") | |
# 記錄玩家贏、輸、平手次數 | |
scores = [0,0,0] | |
# 玩家出拳 | |
for i in range(1, 4): | |
while True: | |
user_hand = input("請出拳 (1) 剪刀 (2) 石頭 (3) 布:") |
OlderNewer