用户:JISLearn查看:0 回复:0 评论:0 创建时间:2022-06-25T11:20:59
【作品展示】

【作品介绍】
猜數字英文版版權:Jace-Ip Studio
創作者:Jace Ip
JIS Learn
【作品源代码】
import time
import random
print('Welcome to the guess number game!!')
print('\n \n loading......')
time.sleep(2)
names = ['Brown Ip', 'Jace Ip', 'AI', 'Your 喵U', 'Randomer', 'Super AI', 'Computer', 'Your Super Duper Computer']
print('I am', random.choice(names), '. I am going to choose a number in 1 to 100. You are going to guess it out.')
readyAns = input(' \n Of couse, I am going to give tips like your number is less than my number. So, Are you Ready?(Fill yes or no) ')
def run():
print('Game is going to start!')
print('3')
time.sleep(1)
print('2')
time.sleep(1)
print('1')
time.sleep(1)
print('Go')
number = random.randint(1, 100)
print('\n Okay! I have already choose a number, your turn to guess...')
times = 0
ans = '0'
while (int(ans) != number):
ans = input('\n number? ')
if (int(ans) > number):
print('\n Your number is greater than mine! Try again!')
times += 1
elif (int(ans) < number):
print(' \n Your number is less than mine! Try again please!')
times += 1
else:
break
print(' \n You guess my number after', times, 'times. Good job!')
def Error():
print(' \n \n Unknow answer, On board line 4. Starting from the 112 character (Including spaces)')
if (readyAns == 'yes'):
run()
elif (readyAns == 'no'):
print(' \n Okay! Restart the program when you are ready to guess the number.')
else:
Error()
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn