def countNumby10s(m, t): io.printTTS("Count from 10 up to {} by 10 s".format(m)) # if t == 1, randomly skip a number if t: t = (int)(random.SystemRandom().choice(string.digits)) * 10 for i in range(10, m+1, 10): if i == t: continue io.printTTS(str(i)) # wait for 1 second time.sleep(1) io.printTTS('Is there any number missing in this sequence? Say yes or no') ans = io.readLine() if ans not in ['yes', 'no']: io.printTTS('Is there any number missing in this sequence? Please input from keyboard: y for yes, n for no') ans = io.readChar() while ans not in ['yes', 'no', 'y', 'n']: io.printTTS('Please input from keyboard: y for yes, n for no') ans = io.readChar() if (ans in ['yes', 'y'] and t): io.printTTS(emoji.emojize(':thumbs_up: ')*3 + "You got it. {} is missing".format(t)) elif (ans in ['no', 'n'] and not t): io.printTTS(emoji.emojize(':thumbs_up: ')*3 + "You got it. All numbers are there") else: if ans in ['yes', 'y']: io.printTTS(emoji.emojize(':thumbs_down: ')*3 + "Wrong. You say there is some number missing, but actually all numbers are in the sequence") if ans in ['no', 'n']: io.printTTS(emoji.emojize(':thumbs_down: ')*3 + "Wrong. You say there is no number missing, but actually {} is NOT in the sequence".format(t))
def compareItems(a, b, item): io.printTTS("Count {}".format(item)) print(emoji.emojize((':'+item+': ') *a) + ' | ' + emoji.emojize((':'+item+': ') *b)) io.printTTS('Do the left-side and right-side has same number of {}? Please input y for yes, n for no'.format(item)) ans = io.readChar() while ans not in ['n', 'N', 'y', 'Y']: print("You can only input 'n' or 'y'") ans = io.readChar() if (ans in ['y', 'Y'] and a == b): print(emoji.emojize(':thumbs_up: ')*3 + "You got it. Both left and right sides have {} {}".format(a,item)) elif (ans in ['n', 'N'] and a != b): print(emoji.emojize(':thumbs_up: ')*3 + "You got it. Left side has {} {}, but right side has {} {}".format(a,item, b,item)) else: print(emoji.emojize(':thumbs_down: ')*3 + "Wrong. Left side has %d %s, but right side has {} {}".format(a,item, b,item))
def chooseGrade(): gradeList = [str(i) for i in range(1, 9)] gradeList = ['k'] + gradeList while 1: io.printTTS('Please choose the Grade of the student:') io.printTTS(" k for Kindergarten") io.printTTS(" [1-8] for Grade 1 to 8") grade = io.readChar() if grade in gradeList: return grade else: io.printTTS( "Only Grade {} is currently supported".format(gradeList)) continue