随机生成1~10之间的一个整数,提示用户去猜,用户最多可以猜3次;
如果在3次内猜对答案,程序结束,显示如“答对了,您猜了2次!”的信息;
如果猜错,显示信息如“太大了”,“太小了”等提示。
## main.py# Random Access Memory## Created by Mewlan Musajan on 4/29/21.#import randomg = random.randint(1, 10)b = int(input('1 DIN 10 GHICHE PÜTÜN SAN KIRGÜZÜNG: '))def isIntValid():global bwhile b < 1 or b > 10:b = int(input('1 DIN 10 GHICHE PÜTÜN SAN KIRGÜZÜNG, QAYTA KIRGÜZÜNG: '))isIntValid()def guessInt():a = 1global bwhile b != g or a == 3:if b > g:b = int(input('CHONG BOP KETTI, QAYTA KIRGÜZÜNG: '))a += 1else:b = int(input('KICHIK BOP KETTI, QAYTA KIRGÜZÜNG: '))a += 1if a >= 3 and b != g:print('3 QÉTIMDIN ARTUQ KIRGÜZÜLDI, GAME OVER!')breakelif b == g:print('JAWABINGIZ TOGHRA BOLDI.') guessInt()