File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change
1
+ import random
2
+ import math
3
+ a = random .randrange (1 ,5 ,1 )
4
+ b = random .randrange (- 15 ,15 ,3 )
5
+ c = random .randrange (- 25 ,25 ,1 )
6
+
7
+ def checkReal (a ,b ,c ):
8
+ if b ** 2 - 4 * a * c >= 0 :
9
+ x1 = (- b + math .sqrt (b ** 2 - 4 * a * c ))/ (2 * a )
10
+ x2 = (- b - math .sqrt (b ** 2 - 4 * a * c ))/ (2 * a )
11
+
12
+ h .write (f' { a } x^2 + { b } x + { c } = 0' )
13
+ h .write ("\n \n \n " )
14
+
15
+ j .write (f' { a } x^2 + { b } x + { c } = 0 : { x1 } & { x2 } ' )
16
+ j .write ("\n \n \n " )
17
+ else :
18
+ a = random .randrange (1 ,5 ,1 )
19
+ b = random .randrange (- 15 ,15 ,3 )
20
+ c = random .randrange (- 25 ,25 ,1 )
21
+ checkReal (a ,b ,c )
22
+ with open ("quadraticPractice.txt" , "w" ) as h :
23
+ with open ("quadratic_AnswerKey.txt" , "w" ) as j :
24
+ for i in range (1 ,20 ):
25
+ a = random .randrange (1 ,5 ,1 )
26
+ b = random .randrange (- 15 ,15 ,3 )
27
+ c = random .randrange (- 25 ,25 ,1 )
28
+ checkReal (a ,b ,c )
You can’t perform that action at this time.
0 commit comments