+
+
+def specialQuestion(oldq):
+ newq = {'question': oldq['question'], 'answer': oldq['answer']}
+ qtype = oldq['question'].upper()
+
+ if qtype == "!MONTH":
+ newq['question'] = "What month is it currently (in UTC)?"
+ newq['answer'] = time.strftime("%B").lower()
+ elif qtype == "!MATH+":
+ randnum1 = random.randrange(0, 11)
+ randnum2 = random.randrange(0, 11)
+ newq['question'] = "What is %d + %d?" % (randnum1, randnum2)
+ newq['answer'] = spellout(randnum1+randnum2)
+ return newq
+
+def spellout(num):
+ return [
+ "zero", "one", "two", "three", "four", "five", "six", "seven", "eight",
+ "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen",
+ "sixteen", "seventeen", "eighteen", "nineteen", "twenty"
+ ][num]