python/2024-6-23-2.py

18 lines
714 B
Python
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import random
secret_number = random.randint(1, 100)
for attempts in range(1, 6):
guess = int(input("猜猜看数字是多少1-100之间"))
if guess == secret_number:
print("你居然猜对了!你猜了", attempts, "次,真菜!像只小菜一样!不是有啥实力啊!!!")
break
elif guess < secret_number:
print("小了,太菜了!像只小菜一样!有啥实力啊!!!")
else:
print("大了,太菜了!像只小菜一样!有啥实力啊!!!")
if attempts == 5 and guess != secret_number:
print("你没有在5次之内猜对真菜像只小菜一样不是有啥实力啊正确答案是", secret_number)