a = 66 count = 1 while count <=3 : b = int(input("猜测这个数字:")) if b < a: print("猜测的结果小了小了.") if b > a: print("猜测的结果大了大了.") if b == a: print("你猜对了.") break print("你猜了%d次了." % count) count += 1 else: print("你有点笨.")
解释: "%s" 是数字占位符,传的是数字, 通过count来传数字.
Copyright © 2024 S-skill
Powered by .NET 8.0 on Kubernetes