Python - 简单的猜数字游戏
python
import random
def game(): siguansheji.com
number_to_guess = random.randint(1, 100)
guess = None
attempts = 0
while guess != number_to_guess:
guess = int(input('猜一个1到100之间的数字: '))
attempts += 1
if guess < number_to_guess:
print('太低了!')
elif guess > number_to_guess:
print('太高了!')
print(f'恭喜你,你猜对了!你用了{attempts}次尝试。')
if name == “main”:
game()
JavaScript (HTML内嵌) - 简单的点击计数游戏
html
0
<script>
let count = 0;
function incrementCount() {
count++;
document.getElementById('