253) x1 = -1; x2 = 13
254) x1 = -6; x2 = -1
255) x1 = -7; x2 = -7
256) x1 = 4; x2 = 7
257) x1 = 49; x2 = 2
258) x1 = -9; x2 = 13
259) x1 = 7; x2 = -13
260) x1 = 1; x2 = -17
261) x1 = -2; x2 = -1
262) x1 = 4; x2 = -2
263) x1 = 4; x2 = -13
264) x1 = 15; x2 = 2
265) x1 = -25; x2 = -1
266) x1 = -4; x2 = -1
267) x1 = 21; x2 = -1
268) x1 = 9; x2 = -5
269) x1 = -15; x2 = -3
270) x1 = -14; x2 = 1
271) x1 = -9; x2 = -1
272) x1 = 6; x2 = -13
273) x1 = 2; x2 = -13
274) x1 = -15; x2 = -2
275) x1 = -4; x2 = -17
276) x1 = 4; x2 = -17
277) x1 = -15; x2 = -5
278) x1 = -25; x2 = -5
279) x1 = -6; x2 = -11
280) x1 = 21; x2 = -2
281) x1 = -10; x2 = -3
282) x1 = -21; x2 = -3
283) x1 = -14; x2 = 7
284) x1 = -49; x2 = -2
285) x1 = 10; x2 = -11
286) x1 = -9; x2 = 11
287) x1 = -9; x2 = -3
288) x1 = 25; x2 = -2
289) x1 = -14; x2 = -7
290) x1 = -4; x2 = 7
291) x1 = -35; x2 = -3
292) x1 = -21; x2 = -1
293) x1 = -4; x2 = -7
294) x1 = -2; x2 = -13
295) x1 = 1; x2 = -13
296) x1 = 10; x2 = -3
297) x1 = -25; x2 = -3
298) x1 = 25; x2 = -3
299) x1 = -4; x2 = -5
300) x1 = -1; x2 = -17
301) x1 = -3; x2 = -3
302) x1 = 6; x2 = -1
303) x1 = -4; x2 = -11
304) x1 = 15; x2 = -1
305) x1 = 25; x2 = -1
306) x1 = 4; x2 = -3
307) x1 = -5; x2 = -5
308) x1 = -4; x2 = -13
309) x1 = -9; x2 = -13
310) x1 = -10; x2 = -11
311) x1 = -9; x2 = -5
312) x1 = -1; x2 = -13
313) x1 = -4; x2 = -3
314) x1 = -1; x2 = -1
315) x1 = 4; x2 = -7
316) x1 = -10; x2 = -1
317) x1 = -9; x2 = -11
318) x1 = -49; x2 = -1
Приложение 5. Последняя версия программы генерации задач
* Введена блокировка повторяющихся уравнений. (строки 48, 49 и функция comp_List)
* Убрав второй сомножитель в строке 41 — откажемся от усложнения уравнений.
* В строке 50 фрагмент «and abs(c) < 126» ограничивает величины цифр в уравнениях.
Ясно, что поиграв с кодом этого примера можно получить самые разнообразные листинги КУ.
.1 | # -*- coding: utf-8 -*-
.2 | import random
.3 |
.4 | def gen_number(k):
.5 | . . prime_number =(1, 2, 3, 5, 7, 11, 13, 17)
.6 | . . sign_number =(0, 1, 2, 3)
.7 | . . nu = prime_number[random.randint(0, k)]
.8 | . . sign = random.choice(sign_number)
.9 | . . if sign == 0:
10 | . . . . nu = nu * -1
11 | . . return nu
12 |
13 | def show_numb(a):
14 | . . if a > 0:
15 | . . . . return ' + '+ str(a)
16 | . . return ' - ' + str(abs(a))
17 |
18 | def comp_List(L, m):
19 | . . for k in L:
20 | . . . . if k == m :
21 | . . . . . . return False
22 | . . return True
23 | . .
24 | TopList = ['<html>', '<head><title></title></head>','<body>']
25 |
26 | f = open("quadratic.htm", 'w')
27 | f2 = open("answer.htm", 'w')
28 |
29 | for ind in TopList:
30 | . . f.write(ind + '\n')
31 | for ind in TopList:
32 | . . f2.write(ind + '\n')
33 |
34 | f.write('<table width=100%>\n')
35 | f2.write('<table width=100%>\n')
36 | tr = 0
37 | count = 1
38 | List = []
39 |
40 | for i in range(50000):
41 | . . x1 = gen_number(4) * gen_number(4)
42 | . . x2 = gen_number(7)
43 | . . b = x1 + x2
44 | . . c = x1 * x2
45 | . .
46 | . . m = str(b) + ' ' + str(c)
47 | . . . . . .
48 | . . if comp_List(List, m):
49 | . . . . List.append(m)
50 | . . . . if b != 0 and abs(c) < 126:
51 | . . . . . . if tr == 0:
52 | . . . . . . . . f.write('<tr>')
53 | . . . . . . . . f2.write('<tr>')
54 | . . . . . . f.write('<td><p>')
55 | . . . . . . f.write(str(count) + ') x<sup>2</sup> '+ show_numb(b*-1) + 'x ' +show_numb(c) + ' = 0' )
56 | . . . . . . f.write('</p></td>\n')
57 | . . . . . . f2.write('<td><p>')
58 | . . . . . . f2.write(str(count) + ') x<sub>1</sub> = '+ str(x1) + '; x<sub>2</sub> = ' + str(x2) )
59 | . . . . . . f2.write('</p></td>\n')
60 | . . . . . . count += 1
61 | . . . . . . tr += 1
62 | . . . . . . if tr == 3: