def multiplication(): r1 = random.randint(2, 10) # consts r2 = random.choice(("a", "b", "c", "x", "y", "z")) # variable r3 = random.randint(20, 30) # rhs const sol = r3 / r1 #correct ans sol1 = r3 // r1 op = sol1 #option displayed if op == sol: ans = "Yes" #actual answer (yes/no) wrong_ans = "No" else: ans = "No" wrong_ans = "Yes" eqn = latex(str(r1) + r2 + " = " + str(r3)) # Question ques = "For the equation " + str(eqn) + ", is the value of " + latex( r2 + " = " + str(op)) + " ? (Yes/No)" print(ques) def sol(): sol1 = latex(str(r1) + r2 + " = " + str(r3)) + "\n" sol1 = sol1 + latex( to_frac(str(r1) + r2, str(r1)) + " = " + to_frac(str(r3), str(r1)) ) + " (Dividing " + str(r1) + " on both sides)" + "\n" sol1 = sol1 + latex(r2 + " = " + to_frac(str(r3), str(r1))) + "\n" sol1 = sol1 + latex(r2 + " = " + str(r3 / r1)) return sol1 print(sol()) Solution = sol() Corr_op = ans wrong_op1 = wrong_ans Question = ques wrong_op2, wrong_op3 = "", "" database_dict = database_fn("text", Answer_Type='1', Topic_Number='030203', Variation='v2', Question=Question, ContributorMail="*****@*****.**", Correct_Answer_1=Corr_op, Wrong_Answer_1=wrong_op1, Wrong_Answer_2=wrong_op2, Wrong_Answer_3=wrong_op3, Solution_text=Solution) return database_dict value = str(input("Enter Yes/No: ")) #input answer if value.capitalize() == ans: print("\nRight option!") print(">---------------------------<") sol() else: print("\nWrong Option!") print(">---------------------------<") sol()
def addition(): r1 = random.randint(3, 10) #print(num2words(r1)) r2 = random.choice(("a", "b", "c", "x", "y", "x")) r3 = random.randint(3, 20) ques = "The sum of a cetrtain number and " + num2words( r1) + " is " + num2words(r3) + ",represent in equation" sol = latex(r2 + "+" + str(r1) + "=" + str(r3)) print(ques) #OPTION GENERATION op = [0, 0, 0, 0] sq = [0, 1, 2, 3] ra = random.randint(0, 3) op[ra] = sol sq.remove(ra) op[sq[0]] = latex(str(str(r1) + str(r2)) + "=" + str(r3)) op[sq[1]] = latex(str(str(r1) + str(r2) + "+" + str(r1)) + "=" + str(r3)) op[sq[2]] = latex(str(str(r2) + "=" + str(r1)) + "-" + str(r3)) for i in range(1, 5): print(i, ". ", op[i - 1]) def sol(): sol1 = "Let's say certain no. will be :" + latex(str(r2)) + "\n" sol1 = sol1 + "Sum means addition" + "\n" sol1 = sol1 + "Constant terms are : " + latex( str(r1)) + " and " + latex(str(r3)) + "\n" sol1 = sol1 + "solution would be : " + latex( str(r2) + "+" + str(r1) + "=" + str(r3)) + "\n" return sol1 print(sol()) Solution = sol() Corr_op = op[ra] wrong_op1 = op[sq[0]] Question = ques wrong_op2, wrong_op3 = op[sq[1]], op[sq[2]] database_dict = database_fn("text", Answer_Type='1', Topic_Number='03020101', Variation='v1', Question=Question, ContributorMail="*****@*****.**", Correct_Answer_1=Corr_op, Wrong_Answer_1=wrong_op1, Wrong_Answer_2=wrong_op2, Wrong_Answer_3=wrong_op3, Solution_text=Solution) return database_dict value = int(input("Choose one option : ")) if value == ra + 1: print("\nright option") print(">--------------------------<") sol() elif value != ra + 1 and value < 5 and value > 0: print("\nwrong option") print(">--------------------------<") sol() else: print("invalid choice")
def print_questions(exp=[]): rd.shuffle(exp) #print(exp) question = '\n <br> {} and {}, do they represent two sides of an equation ?'.format( latex(exp[0]), latex(exp[1])) print(question) return exp, question
def getquestion(): ques = "After " + latex( str(p1)) + " years, " + str(n1) + " shall be " + latex( str(p3)) + " times as old as he was " + latex( str(p3) ) + " years ago. Find " + mapping[name] + " present age. " return ques
def sol(): sol1 = latex(str(r1) + r2 + " = " + str(r3)) + "\n" sol1 = sol1 + latex( to_frac(str(r1) + r2, str(r1)) + " = " + to_frac(str(r3), str(r1)) ) + " (Dividing " + str(r1) + " on both sides)" + "\n" sol1 = sol1 + latex(r2 + " = " + to_frac(str(r3), str(r1))) + "\n" sol1 = sol1 + latex(r2 + " = " + str(r3 / r1)) return sol1
def sol(): sol1 = "Let's say certain no. will be : " + latex(str(r2)) + "\n" sol1 = sol1 + "For finding the Dividend, we need to perform division operation" + "\n" sol1 = sol1 + "Divisor : " + latex( str(r1)) + " and Quotient : " + latex(str(r3)) + "\n" sol1 = sol1 + "Solution would be : " + latex( str(r2) + " / " + str(r1) + " = " + str(r3)) return sol1
def sol(): sol1 = latex(str(r2) + " - " + str(r1) + " = " + str(r3) + "\n") sol1 = sol1 + latex( str(r2) + " - " + str(r1) + " + " + str(r1) + " = " + str(r3) + " + " + str(r1) + " (Adding " + str(r1) + " on both sides)" + "\n") sol1 = sol1 + latex(str(r2) + " = " + str(r3 + r1) + "\n") return sol1
def getWrongAnswers(): options = [ latex(random.randint(0, 10)), latex(random.randint(0, 10)), latex(random.randint(0, 10)) ] random.shuffle(options) return options
def sol(): sol1 = "Let's say certain no. will be :" + latex(str(r2)) + "\n" sol1 = sol1 + "Sum means addition" + "\n" sol1 = sol1 + "Constant terms are : " + latex( str(r1)) + " and " + latex(str(r3)) + "\n" sol1 = sol1 + "solution would be : " + latex( str(r2) + "+" + str(r1) + "=" + str(r3)) + "\n" return sol1
def subtraction(): r1 = random.randint(20,50) r2 = random.randint(2,20) r3 =random.choice(("a","b","c","x","y","z")) ques="Ques. The difference obtained by subtracting "+num2words(r1)+" from certain number is "+num2words(r2)+",represent in equation " sol = latex(r3+" - "+str(r1)+" = "+str(r2)) print(ques) #option generation op = [0,0,0,0] sq = [0,1,2,3] ra = random.randint(0,3) op[ra]=sol sq.remove(ra) op[sq[0]]=latex(str(str(r1)+"-"+str(r3)+"="+str(r2)))#11-x=6 op[sq[1]]=latex(str(str(r2)+" - "+str(r3)+" = "+str(r1)))#6-x=11 op[sq[2]]=latex(str(str(r3)+" - "+str(r2)+" = "+str(r1)))#x-6=11 for i in range(1,5): print(i,". ",op[i-1]) def sol(): sol1="Let's say certain number is :"+latex(str(r3))+"\n" sol1=sol1+"Difference is subtraction"+"\n" sol1=sol1+"Constant terms are : "+latex(str(r1))+" and "+latex(str(r2))+"\n" sol1=sol1+"Solution would be : "+latex(str(r3+" - "+str(r1)+" = "+str(r2))) return sol1 print(sol()) Solution = sol() Corr_op = op[ra] wrong_op1=op[sq[0]] Question = ques wrong_op2,wrong_op3 = op[sq[1]],op[sq[2]] database_dict= database_fn("text", Answer_Type='1', Topic_Number='03020101', Variation='v2', Question=Question, ContributorMail="*****@*****.**", Correct_Answer_1=Corr_op, Wrong_Answer_1=wrong_op1, Wrong_Answer_2=wrong_op2, Wrong_Answer_3=wrong_op3, Solution_text=Solution ) return database_dict value = int(input("Choose one option :")) if value==ra+1 : print("\n Right Option") print(">--------------------------------<") sol() elif value !=ra+1 and value<5 and value > 0: print("\n Wrong Option") print(">--------------------------------<") sol() else: print("Invalid Choice")
def sol(): sol = "Solution:" sol = sol + "Equation can be defined as a mathematical statement \nin which two expressions are set equal to each other" sol = sol + "In option => " + op[ra] sol = sol + "=> " + latex(str(varx)) + " is the variable and " + latex( str(x1)) + latex(str(varx)) + " is the variable term" sol = sol + "=> " + latex(str(y2)) + " and " + latex( str(c3)) + " are the constant terms" return sol
def sol(): sol1 = latex(r2 + " / " + str(r1) + " = " + str(r3)) + "\n" sol1 = sol1 + latex("( " + r2 + " / " + (str(r1)) + " )" + " * " + str(r1) + " = " + str(r3) + " * " + str(r1) + " (Multiplying " + str(r1) + " on both sides)") + "\n" sol1 = sol1 + latex(r2 + " = " + str(r3) + " * " + str(r1)) + "\n" sol1 = sol1 + latex(r2 + " = " + str(r3 * r1)) return sol1
def print_option(option1, option2, option3, option4, var1, var2, variable): return latex(' ( {} {} {} ) {} {} = {} {} {} '.format( variable, option1[0], var1, option1[1], var1, var2, option1[1], var1)), latex(' ( {} {} {} ) {} {} = {} {} {} '.format( variable, option2[0], var1, option2[1], var1, var2, option2[1], var1)), latex(' ( {} {} {} ) {} {} = {} {} {} '.format( variable, option3[0], var1, option3[1], var1, var2, option3[1], var1)), latex(' ( {} {} {} ) {} {} = {} {} {} '.format( variable, option4[0], var1, option4[1], var1, var2, option4[1], var1))
def sol2(): sol2=("Since, it is given that "+n1+", "+n2+", "+n3+" and "+n4+"\nhave a total of "+latex(str(r1))+", "+latex(str(r2))+", "+latex(str(r3))+" and "+latex(str(r4))+" "+i+" respectively")+"\n" if r1+r2==r3+r4: a=r1+r2 b=r3+r4 sol2=sol2+("Now, "+latex(str(r1)+" + "+str(r2)+" = "+str(a)))+"\n" sol2=sol2+("Also, "+latex(str(r3)+" + "+str(r4)+" = "+str(b)))+"\n" sol2=sol2+("=> "+latex(str(r1)+" + "+str(r2)+" = "+str(r3)+" + "+str(r4)))+"\n" sol2=sol2+("=> L.H.S = R.H.S")+"\n" sol2=sol2+("As we know that,\nAn Equation is a mathematical statement consisting of an equal symbol between two expressions having the same value.")+"\n" sol2=sol2+("Therefore, according to the question,\nThe two pairs which will form an equation are : "+n1+" and "+n2+" , "+n3+" and "+n4)+"\n" elif r1+r3==r2+r4: a=r1+r3 b=r2+r4 sol2=sol2+("Now, "+latex(str(r1)+" + "+str(r3)+" = "+str(a)))+"\n" sol2=sol2+("Also, "+latex(str(r2)+" + "+str(r4)+" = "+str(b)))+"\n" sol2=sol2+("=> "+latex(str(r1)+" + "+str(r3)+" = "+str(r2)+" + "+str(r4)))+"\n" sol2=sol2+("=> L.H.S = R.H.S")+"\n" sol2=sol2+("As we know that,\nAn Equation is a mathematical statement consisting of an equal symbol between two expressions having the same value.")+"\n" sol2=sol2+("Therefore, according to the question,\nThe two pairs which will form an equation are : "+n1+" and "+n3+" , "+n2+" and "+n4)+"\n" elif r1+r4==r2+r3: a=r1+r4 b=r2+r3 sol2=sol2+("Now, "+latex(str(r1)+" + "+str(r4)+" = "+str(a)))+"\n" sol2=sol2+("Also, "+latex(str(r2)+" + "+str(r3)+" = "+str(b)))+"\n" sol2=sol2+("=> "+latex(str(r1)+" + "+str(r4)+" = "+str(r2)+" + "+str(r3)))+"\n" sol2=sol2+("=> L.H.S = R.H.S")+"\n" sol2=sol2+("As we know that,\nAn Equation is a mathematical statement consisting of an equal symbol between two expressions having the same value.")+"\n" sol2=sol2+("Therefore, according to the question,\nThe two pairs which will form an equation are : "+n1+" and "+n4+" , "+n2+" and "+n3)+"\n" return sol2
def sol(): sol = ("solution: \n") sol = sol + (latex(str(r1) + "x - " + str(r2) + " = " + str(r3))) + "\n" sol = sol + str( latex(str(r1) + "x = " + str(r3) + " + " + str(r2)) + " (adding " + str(r2) + " to both sides)") + "\n" sol = sol + str(latex(str(r1) + "x = " + str(y))) + "\n" sol = sol + str( latex("x = " + to_frac(str(y), str(r1))) + " (dividing by " + str(r1) + " in both sides)") + "\n" sol = sol + str(latex("x = " + str(x))) + "\n" return sol
def getQuestion(): # ques="After "+str(r1)+" years, "+str(n1)+" shall be "+str(r3)+" times as old as he was "+str(r3)+" years ago. Find "+mapping[name]+" present age. " # return ques ques = name + " bought some kilograms of " + ( cop ) + ". " + mapping[name] + " requires " + latex(str(r1)) + latex( "kg ") + "per month and " + mapping[name] + " got enough " + ( cop) + " milled for " + latex( str(r2) ) + " months. After that " + mapping[name] + " had " + latex( str(r3)) + latex("kg ") + " left. How much " + ( cop) + " had " + name + " bought altogether?" return ques
def notequi(): r1=random.randint(2,30) r2=random.randint(15,30) op=["<",">"] operation = random.choice(op) notequi1=latex(str(r1)+"p"+" "+str(operation)+" "+str(r2)) return notequi1
def main_function(): arr1 = ['a', 'b', 'c', 'm', 'n', "x", "y", 'z'] variable = latex(random.choice(arr1)) solu = "\n-----------------SOLUTION--------------------- \n Since we do not know the exact number of " + str( item) + " with " + str(n1) + " and " + str( n2) + " let us use letter " + str( variable) + " to represent unknown quantity of " + str( item) + " with " + str(n1) solu = solu + " and since " + str(n2) + " holds equal no. of " + str( item) + " we can represent number of " + str( item) + " with her again as " + str(variable) + "." question = getQuestion() CorrectAnswer1 = variable Wrong_Answer_1, Wrong_Answer_2, Wrong_Answer_3 = getWrongAnswers() database_dict = database_fn(Answer_Type='text', Topic_Number='030101', Variation=2, Question=question, Correct_Answer_1=CorrectAnswer1, Wrong_Answer_1=Wrong_Answer_1, Wrong_Answer_2=Wrong_Answer_2, Wrong_Answer_3=Wrong_Answer_3, ContributorMail='*****@*****.**', Solution_text=solu) return database_dict
def changeGlobals(): global container, item, variable container = random.choice(['container', 'box', 'jar', 'pouch', 'drawer']) item = random.choice([ 'pencils', 'erasers', 'staplers', 'sharperners', 'rulers', 'pens', 'brushes', 'crayons' ]) variable = latex(random.choice('abckmnxyz'))
def sol8(): global n1,n2,n3,n4,n5,r1,r2,r3,r4,i sol8=("Since, it is given that the weights of "+n1+", "+n2+", "+n3+" and "+n4+"\nare "+latex(str(r1))+", "+latex(str(r2))+", "+latex(str(r3))+" and "+latex(str(r4))+" respectively")+"\n" if abs(r1-r2)==abs(r3-r4): if r2>r1: r2,r1=r1,r2 if r4>r3: r4,r3=r3,r4 a=r1-r2 b=r3-r4 sol8=sol8+("Now, "+latex(str(r1)+" - "+str(r2)+" = "+str(a)))+"\n" sol8=sol8+("Also, "+latex(str(r3)+" - "+str(r4)+" = "+str(b)))+"\n" sol8=sol8+("=> "+latex(str(r1)+" - "+str(r2)+" = "+str(r3)+" - "+str(r4)))+"\n" sol8=sol8+("=> L.H.S = R.H.S")+"\n" sol8=sol8+("As we know that,\nAn Equation is a mathematical statement consisting of an equal symbol between two expressions having the same value.")+"\n" sol8=sol8+("Therefore, according to the question,\nThe two pairs which will form an equation are : "+n1+" and "+n2+" , "+n3+" and "+n4)+"\n" elif abs(r1-r3)==abs(r2-r4): if r3>r1: r3,r1=r1,r3 if r4>r2: r4,r2=r2,r4 a=r1-r3 b=r2-r4 sol8=sol8+("Now, "+latex(str(r1)+" - "+str(r3)+" = "+str(a)))+"\n" sol8=sol8+("Also, "+latex(str(r2)+" - "+str(r4)+" = "+str(b)))+"\n" sol8=sol8+("=> "+latex(str(r1)+" - "+str(r3)+" = "+str(r2)+" - "+str(r4)))+"\n" sol8=sol8+("=> L.H.S = R.H.S")+"\n" sol8=sol8+("As we know that,\nAn Equation is a mathematical statement consisting of an equal symbol between two expressions having the same value.")+"\n" sol8=sol8+("Therefore, according to the question,\nThe two pairs which will form an equation are : "+n1+" and "+n3+" , "+n2+" and "+n4)+"\n" elif abs(r1-r4)==abs(r2-r3): if r4>r1: r2,r1=r1,r2 if r4>r3: r4,r3=r3,r4 a=r1-r4 b=r2-r3 sol8=sol8+("Now, "+latex(str(r1)+" - "+str(r4)+" = "+str(a)))+"\n" sol8=sol8+("Also, "+latex(str(r2)+" - "+str(r3)+" = "+str(b)))+"\n" sol8=sol8+("=> "+latex(str(r1)+" - "+str(r4)+" = "+str(r2)+" - "+str(r3)))+"\n" sol8=sol8+("As we know that,\nAn Equation is a mathematical statement consisting of an equal symbol between two expressions having the same value.")+"\n" sol8=sol8+("Therefore, according to the question,\nThe two pairs which will form an equation are : "+n1+" and "+n4+" , "+n2+" and "+n3)+"\n" return sol8
def print_solution(rows, corr_op): sol = 'Evaluate each pair of equation and compare it by doing so you will get solution for each pair as follows-\n <br>' for oprt, exps in rows.items(): sol += 'In expressions - {} <br>'.format(latex(exps)) sol += print_eval_exp(oprt, exps) sol = sol + '''\n <br> Thus the correct option is - {}'''.format( format_dict(corr_op)) print(sol) return sol
def num(): ops = ['+', '-', '*', '/'] num1 = random.randint(12,35) num2 = random.randint(1,12) operation = random.choice(ops) op=["<",">"] opr= random.choice(op) maths = eval(str(num1) + operation + str(num2)) num1 = latex(str(num1)+" "+str(operation)+" "+str(num2)+" "+str(opr)+" "+str(maths)) return num1
def equi(): global x1,y2,c3,opx,varx x1=random.randint(2,30) y2=random.randint(3,30) c3=random.randint(15,30) op=['+', '-', '*', '/'] var=["a","b","c","x","y","z"] opx = random.choice(op) varx = random.choice(var) equi1 = latex(str(x1)+str(varx)+" "+str(opx)+" "+str(y2)+" = "+str(c3)) return equi1
def sol(): sol = "Let's assume the certain number to be: " + latex(str(r2)) + "\n" sol = sol + "Product means multiplication" + "\n" sol = sol + "Hence, the certain number " + latex( str(r2)) + " is to be multiplied by " + latex(str(r1)) + "\n" sol = sol + "Solution would be: " + latex(solution) + "\n" sol = sol + "Coefficient of " + latex(str(r2)) + " is: " + latex( str(r1)) + "\n" sol = sol + "Constant term is: " + latex(str(r3)) + "\n" return sol
def print_solution(exp): section1=''' \n====================Solution====================<br> \nTo check equality of expressions we will check if both of them give same result or not''' print(section1) expression1 = '{} = {}'.format(exp[0],eval(exp[0])) section2 = '''\n <br>First expression {}'''.format(latex(expression1)) print(section2) expression2 = '{} = {}'.format(exp[1],eval(exp[1])) section3 = '''\n <br>Second expression {}'''.format(latex(expression2)) print(section3) if(eval(exp[0]) == eval(exp[1])): section4='''\n<br>Since both expression give same values i.e. {}, answer is True'''.format(latex(eval(exp[0]))) print(section4) else: section4 = '''\n<br>Since both expressions give different values, the answer is False''' print(section4) solution = section1 + section2 + section3 + section4 return solution
def sol(): sol = 'Let the number of ' + i + " with " + str(n1) + ' initially be ' + latex( 'x') + '.' + '<br/> After buying ' + str(r2) + ' ' + i + ' ' + str(n1) + ' has ' + str( r1) + ' ' + i + ' left' + '<br/> Total number of ' + i + ' = Initial number of ' + i + ' + Number of ' + i + ' bought ' + '<br/> Therefore ' + latex( 'x + ' + str(r2) + ' = ' + str(r1)) + '<br/>' + latex( '<br/> x + ' + str(r2) + ' ''- ' + str(r2) + ' = ' + str(r1) + ' - ' + str(r2)) + ' (Subtract ' + latex(str( r2)) + ' from both sides)' a = r1 - r2 sol = sol + '<br/>' + latex('<br/> x + 0 = ') + latex(str(a)) + '<br/>' sol = sol + latex("<br/> x = ") + latex(str(a)) sol = sol + '<br/> Therefore, ' + latex('x' + ' = ' + str(a)) sol = sol + '<br/> Thus, there were ' + latex(str(a)) + ' ' + i + ' with ' + n1 + ' initially' return sol
def sol(): sol = ('''Let us assume that the number of ''' + i + ''' with ''' + n1 + ''' at first be ''' + latex('x') + '<br/>' + n1 + ' sold ' + latex(str(r2)) + i + ' and left with ' + latex(str(r1)) + i + '<br/>' + ' Number of ' + i + ' left = ' ' Number of ' + i + ' initially - ' ' Number of ' + i + ' sold at the market ' + '<br/>' + ' Therefore,' + latex('x -' + str(r2) + ' = ' + str(r1)) + ' ' + '<br/>' + latex('x - ' + str(r2) + ' + ' + str(r2) + ' = ' + str(r1) + ' + ' + str(r2)) + ' (Add ' + latex(str(r2)) + ' to both sides)') a = r1 + r2 str1 = ' x + 0 =' + str(a) str2 = ' x = ' + str(a) sol = sol + '<br/>' + latex(str(str1)) sol = sol + '<br/>' + latex(str(str2)) sol = sol + '<br/> Thus, there were ' + latex( str(a)) + ' ' + i + ' with ' + n1 + ' at first' return sol
def print_options(ans=[]): options = [] global Correct_op, Wrong_op1, Wrong_op2, Wrong_op3 options.append( latex('({}\\times k)\div {} = {}\div{} '.format( ans[1], ans[1], ans[0], ans[1]))) Correct_op = options[0] options.append(latex('k+{} = {}+{} '.format(ans[1], ans[0], ans[1]))) options.append( latex('{} \\times k = {} \\times {} '.format(ans[1], ans[0], ans[1]))) options.append(latex('k-{} = {}-{} '.format(ans[1], ans[0], ans[1]))) #print(Correct_op) Wrong_op1 = options[1] Wrong_op2 = options[2] Wrong_op3 = options[3] #Now shuffling options rd.shuffle(options) print('''\nOptions:<br> \n1) {}<br> \n2) {}<br> \n3) {}<br> \n4) {}<br>'''.format(options[0], options[1], options[2], options[3])) i = 0 answer = options[0] t = latex('({}\\times k)\div {} = {}\div{} '.format( ans[1], ans[1], ans[0], ans[1])) while (answer != t): i += 1 answer = options[i] return (i + 1)
def print_questions(exp=[]): name, p, e = getName() if (p == 'He'): k = 'his' else: k = 'her' key = rd.randint(0, 1) global Question if (key): k = rd.choice(['splitted', 'distributed']) e = 'cookies' Question = '\n\n{} baked {} cookies and {} them equally into {} packs. How many cookies did {} put in each packet?Let {} put $k$ cookies in each packet.Select the correct statements from below.<br>'.format( name, latex(exp[0]), k, latex(exp[1]), name, name) print(Question) #print('\nLet {} put k cookies in each packet.'.format(name)) else: Question = '\n\n{} had {} {}. {} distributes all {} evenly among {} friends.How many {} did {} gave to each of {} friends?Let each friend of {} gets $k$ {}.Select the correct statements from below.<br>'.format( name, latex(exp[0]), e, p, e, latex(exp[1]), e, name, k, name, e) print(Question) #print('\nLet each friend of {} gets k {}.'.format(name,e)) return [name, k, e, key]
def main_function(): n1 = maleMarathi() n2 = femaleMarathi() item = [ 'books', 'flowers', 'bottles', 'plates', 'spoons', 'pencils', 'erasers', 'staplers', 'sharperners', 'rulers', 'pens', 'brushes', 'crayons' ] cop = random.choice(item) arr1 = ['a', 'b', 'c', 'm', 'n', "x", "y", 'z'] variable = latex(random.choice(arr1)) def getQuestion(): ques = n1 + " is having same number of " + cop + " as " + n2 + " has. Each one of them is having how many " + cop + "?" return ques def getWrongAnswers(): options = [ latex(random.randint(0, 4)), latex(random.randint(5, 7)), latex(random.randint(8, 10)) ] random.shuffle(options) return options solu = "Since we do not know the exact number of " + str( cop) + " with " + str(n1) + " and " + str( n2) + " let us use letter " + str( variable) + " to represent the unknown number of " + str( cop) + " with " + str(n1) solu = solu + " and since " + str(n2) + " holds equal number of " + str( cop) + " we can represent the number of " + str( cop) + " with her again as " + str(variable) + "." question = getQuestion() CorrectAnswer1 = variable Wrong_Answer_1, Wrong_Answer_2, Wrong_Answer_3 = getWrongAnswers() database_dict = database_fn(Answer_Type='text', Topic_Number='030101', Variation=2, Question=question, Correct_Answer_1=CorrectAnswer1, Wrong_Answer_1=Wrong_Answer_1, Wrong_Answer_2=Wrong_Answer_2, Wrong_Answer_3=Wrong_Answer_3, ContributorMail='*****@*****.**', Solution_text=solu) return database_dict