1,流程图:
import random question=input("would you want to play a number game?:") if question=="yes": value=random.randint(0,100) ret1=0 ret2=100 while True: count=1 question_two=(int(input("Try to guess the number: "))) if question_two>value: print("请输入%s到%s之间的数"%(ret1,question_two)) ret2=question_two continue elif question_two<value: print("请输入%s到%s之间的数"%(question_two,ret2)) ret1=question_two continue else: print("That\‘s it") question_three=input("would you like to play again?:") if question_three==‘yes‘: continue else: break else: question=="no" 结果为
原文:https://www.cnblogs.com/ab461087603/p/12378703.html