Browse Source

add everything

Moul 3 years ago
parent
commit
2b47804e5a
6 changed files with 2488 additions and 0 deletions
  1. 637 0
      bareme.html
  2. 1173 0
      bareme_computor.html
  3. 146 0
      main.py
  4. 143 0
      rendu1/main.py
  5. 383 0
      tv_correction
  6. 6 0
      while.sh

File diff suppressed because it is too large
+ 637 - 0
bareme.html


File diff suppressed because it is too large
+ 1173 - 0
bareme_computor.html


+ 146 - 0
main.py

@@ -0,0 +1,146 @@
+#!/usr/bin/env python3
+# **************************************************************************** #
+#                                                                              #
+#                                                         :::      ::::::::    #
+#    main.py                                            :+:      :+:    :+:    #
+#                                                     +:+ +:+         +:+      #
+#    By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+         #
+#                                                 +#+#+#+#+#+   +#+            #
+#    Created: 2015/04/22 13:13:05 by mazimi            #+#    #+#              #
+#    Updated: 2015/09/29 13:03:13 by mazimi           ###   ########.fr        #
+#                                                                              #
+# **************************************************************************** #
+
+import sys
+import re
+
+def ft_sqrt (n):
+	a = 1
+	for i in range(0, 10):
+		a = 0.5 * (a + n / a)
+	return (a)
+
+def sign(a, less, more):
+	if a >= 0 and more == 1: print("+", end = " ")
+	if a < 0 and less == 1: print("-", end = " ")
+
+def print_d(n):
+	print("{0:.3f}".format(round(n, 3)), end = " ")
+
+def wrong_degree():
+	print ("Je ne sait pas résoudre les équations de degré polynomial différent de un et deux.")
+	exit()
+
+def	cond_X0(eq, i):
+	if eq[i - 1] != "^" and "0" <= eq[i] and eq[i] <= "9":
+		return (1)
+
+def parse (str):
+	i, s = 0, ""
+	while (i < len(str) - 2):
+		if cond_X0(str, i) and str[i + 1] == " " and str[i + 2] != "*":
+			a = str[:i + 1]; b = str[i + 1:]; s = "";
+			seq = a, " * X^0", b; str = s.join(seq)
+		i = i + 1
+	if cond_X0(str, len(str) - 1):
+		seq = str, " * X^0"; str = s.join(seq)
+	if str[0] == "X": seq  = "1 * ", str; str = s.join(seq)
+	if str[len(str) - 3] == "=" and str[len(str) - 1] == "X":
+		a = str[:len(str) - 1]; seq = a, "1 * X^1"; str = s.join(seq) 
+	str = str.replace("X ", "X^1 "); str = str.replace("+ X^", "+ 1 * X^")
+	str = str.replace("- X^", "- 1 * X^"); str = str.replace("= X^", "= 1 * X^")
+	eq1, eq2 = str.split("=")
+	eq1 = re.split('(\-*\s*[\.0-9]*)\s\*\sX\^(\-*[0-9\.]*)', eq1)
+	eq2 = re.split('(\-*\s*[\.0-9]*)\s\*\sX\^(\-*[0-9\.]*)', eq2)
+	eq = re.split('(\-*\s*[\.0-9]*)\s\*\sX\^(\-*[0-9\.]*)', str)
+	strp = str
+	return (strp, eq, eq1, eq2)
+
+def get_coeff_degree(eq1, eq2):
+	li = [[], []]
+	for i in range(1, len(eq1), 3):
+		t = eq1[i]; li[0].append(float(t.replace(" ", "")));
+		li[1].append(float(eq1[i + 1]))
+	for i in range(1, len(eq2), 3):
+		t = eq2[i];	li[0].append(-float(t.replace(" ", "")));
+		li[1].append(float(eq2[i + 1]))
+	var, deg = 42, 0
+	while var == 42:
+		var, i = 0, 0
+		while i < len(li[1]):
+			t, j = li[1][i], 0
+			while j < len(li[1]):
+				if i != j and t == li[1][j]:
+					var = 42
+					li[0][i] += li[0][j]; del li[0][j], li[1][j]; j -= 1
+					if li[0][i] == 0: del li[0][i], li[1][i]
+				j += 1;
+			i += 1
+	for i in range(0, len(li[1])):
+		if li[1][i] > deg:
+			deg = li[1][i]
+	if (deg != 0 and deg != 1 and deg != 2): wrong_degree()
+	a, b, c = 0, 0, 0
+	for i in range (0, len(li[1])):
+		if li[1][i] == 2: a = li[0][i]
+		if li[1][i] == 1: b = li[0][i]
+		if li[1][i] == 0: c = li[0][i]
+	return (deg, a, b, c)
+
+def display(str, a, b, c, degree):
+	print("Équation entrée :", str)
+	print ("\nÉquation réduite :")
+	if degree == 0: print(c, "= 0\nÉquation fausse et sans inconnue qui n’est pas résolvable."); exit()
+	if degree == 1:
+		a = -2; b = 1 
+		if a == 1 or a == -1: sign(a, 1, 0); print ("X", end = " ");
+		else: print (a, "* X", end = " ");
+		if b < 0: sign(b, 1, 0); print(-b, end = " ")
+		if b > 0: sign(b, 0, 1); print(b, end = " ")
+		print("= 0\naX + b = 0")
+	if degree == 2:
+		if a == 1 or a == -1: sign(a, 1, 0); print ("X²", end = " ");
+		else: print(a, "* X²", end = " ");
+		if b == 1 or b == -1: sign(b, 1, 1); print("X", end = " ")
+		elif b != 0: sign(b, 0, 1); print(b, "X", end = " ");
+		if c != 0: sign(c, 0, 1); print (c, end = " ")
+		print("= 0\naX² + bX + c = 0")
+	print ("Équation de degré polynomial", end = " "); print(int(degree), "\n")
+
+def	solve_degree_2(a, b, c):
+	delta = b**2 - 4 * a * c
+	print ("Calcul du discriminant :\nΔ = b² - 4ac\nΔ =", end = " ")
+	print ("{}² - 4 × {} × {}\nΔ = {}".format(b, a, c, round(delta, 3)))
+	alpha = -b / (2 * a)
+	if delta > 0:
+		beta = ft_sqrt(delta) / (2 * a)
+		print ("Dicriminant scritement positif.\n\nCalcul des solutions :")
+		print ("     -b + √Δ   {} + √{}\nX1 = ——————— = ——————————————— =".format(-b, round(delta, 3)), end = " ");
+		print_d(alpha + beta); print("\n      2 × a        2 ×", a)
+		print("\n     -b - √Δ   {} - √{}\nX2 = ——————— = ——————————————— =".format(-b, round(delta, 3)), end = " ")
+		print_d(alpha - beta); print("\n      2 × a        2 ×", a)
+	if delta == 0:
+		print ("Discriminant nul.\n\nCalcul de la solution :")
+		print ("      -b      {}\nX = ——————— = ——————— = {}\n     2 × a    2 × {}".format(-b, round(alpha, 3), a))
+	if delta < 0:
+		print ("Discriminant négatif.\n\nCalcul des solutions :")
+		print ("     -b + i × √-Δ    {} + i × √{}".format(-b, round(round(-delta, 3), 3)))
+		xi = ft_sqrt(-delta) / (2 * a)
+		print("X1 = ————————————— = ——————————————————— =", end = " ");
+		print_d(alpha); sign(a, 0, 1); print_d (xi);
+		print("× i\n         2 × a          2 ×", a)
+		print ("\n     -b - i × √-Δ    {} - i × √{}".format(-b, round(-delta, 3)))
+		print("X2 = ————————————— = ——————————————————— =", end = " "); print_d(alpha);
+		if a <= 0: print("+", end = " ");
+		print_d (-xi); print ("× i\n        2 × a           2 ×", a)
+
+if __name__ == '__main__':
+	if len(sys.argv) != 2: print("Entrez l’équation à résoudre."); exit()
+	str = sys.argv[1]
+	strp, eq, eq1, eq2 = parse(str)
+	degree, a, b, c = get_coeff_degree(eq1, eq2)
+	display(str, a, b, c, degree)
+	if (degree == 1):
+		print ("Solution :\n    -b    ", -c, "  \nX = ——— = ——————— =", end = " ");
+		print_d(-c / b); print("\n     a    ", b)
+	if (degree == 2): solve_degree_2(a, b, c)

+ 143 - 0
rendu1/main.py

@@ -0,0 +1,143 @@
+# **************************************************************************** #
+#                                                                              #
+#                                                         :::      ::::::::    #
+#    main.py                                            :+:      :+:    :+:    #
+#                                                     +:+ +:+         +:+      #
+#    By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+         #
+#                                                 +#+#+#+#+#+   +#+            #
+#    Created: 2015/04/22 13:13:05 by mazimi            #+#    #+#              #
+#    Updated: 2015/09/29 13:06:23 by mazimi           ###   ########.fr        #
+#                                                                              #
+# **************************************************************************** #
+
+import sys
+import re
+
+def ft_sqrt (n):
+	a = 1
+	for i in range(0, 10):
+		a = 0.5 * (a + n / a)
+	return (a)
+
+def sign(a):
+	if a >= 0: print("+", end = " ")
+
+def print_d(n):
+	print("{0:.3f}".format(round(n, 3)), end = " ")
+
+def wrong_degree():
+	print ("Je ne sait pas résoudre les équations de degré polynomial différent de un et deux.")
+	exit()
+
+def	cond_X0(eq, i):
+	if eq[i - 1] != "^" and "0" <= eq[i] and eq[i] <= "9":
+		return (1)
+
+def parse (str):
+	i = 0 
+	while (i < len(str) - 2):
+		if cond_X0(str, i) and str[i + 1] == " " and str[i + 2] != "*":
+			a = str[:i + 1]; b = str[i + 1:]; s = "";
+			seq = a, " * X^0", b; str = s.join(seq)
+		i = i + 1
+	if cond_X0(str, len(str) - 1):
+		seq = str, " * X^0"; str = s.join(seq)
+	if str[0] == "X": seq  = "1 * ", str; str = s.join(seq)
+	if str[len(str) - 1] == "X":
+		a = str[:len(str) - 1]; seq = a, "1 * X^1"; str = s.join(seq) 
+	str = str.replace("X ", "X^1 "); str = str.replace("+ X^", "+ 1 * X^")
+	str = str.replace("- X^", "- 1 * X^"); str = str.replace("= X^", "= 1 * X^")
+	eq1, eq2 = str.split("=")
+	eq1 = re.split('(\-*\s*[\.0-9]*)\s\*\sX\^(\-*[0-9\.]*)', eq1)
+	eq2 = re.split('(\-*\s*[\.0-9]*)\s\*\sX\^(\-*[0-9\.]*)', eq2)
+	eq = re.split('(\-*\s*[\.0-9]*)\s\*\sX\^(\-*[0-9\.]*)', str)
+	strp = str
+	return (strp, eq, eq1, eq2)
+
+def get_degree(eq):
+	degree = 1 
+	for i in range(2, len(eq), 3):
+		d = float(eq[i])
+		if (d != 0 and d != 1 and d != 2 and d != 3): wrong_degree()
+		if degree < d: degree = d
+	return (degree)
+
+def get_coef(eq1, eq2, degree):
+	a, b, c, d = 0, 0, 0, 0
+	if degree == 3:
+		for i in range(2, len(eq1), 3):
+			if eq1[i] == "3": d2 = eq1[i - 1]; d = d + float(d2.replace(" ", ""))
+		for i in range(2, len(eq2), 3):
+			if eq2[i] == "3": d2 = eq2[i - 1]; d = d - float(d2.replace(" ", ""))
+		if d == 0: degree = 2
+		else: wrong_degree()
+	if degree == 2:
+		for i in range(2, len(eq1), 3):
+			if eq1[i] == "0": c2 = eq1[i - 1]; c = c + float(c2.replace(" ", ""))
+			if eq1[i] == "1": b2 = eq1[i - 1]; b = b + float(b2.replace(" ", ""))
+			if eq1[i] == "2": a2 = eq1[i - 1]; a = a + float(a2.replace(" ", ""))
+		for i in range(2, len(eq2), 3):
+			if eq2[i] == "0": c2 = eq2[i - 1]; c = c - float(c2.replace(" ", ""))
+			if eq2[i] == "1": b2 = eq2[i - 1]; b = b - float(b2.replace(" ", ""))
+			if eq2[i] == "2": a2 = eq2[i - 1]; a = a - float(a2.replace(" ", ""))
+		if a == 0: return (1, b, c, 0)
+		return (degree, a, b, c)
+	if degree == 1:
+		for i in range(2, len(eq1), 3):
+			if eq1[i] == "0": b2 = eq1[i - 1]; b = b + float(b2.replace(" ", ""))
+			if eq1[i] == "1": a2 = eq1[i - 1]; a = a + float(a2.replace(" ", ""))
+		for i in range(2, len(eq2), 3):
+			if eq2[i] == "0": b2 = eq2[i - 1]; b = b - float(b2.replace(" ", ""))
+			if eq2[i] == "1": a2 = eq2[i - 1]; a = a - float(a2.replace(" ", ""))
+		if a == 0: return (0, b, 0, 0)
+		return (degree, a, b, 0)
+	if degree == 0:
+		for i in range(2, len(eq1), 3): a2 = eq1[i - 1]; a = a + float(a2.replace(" ", ""))
+		for i in range(2, len(eq2), 3): a2 = eq2[i - 1]; a = a - float(a2.replace(" ", ""))
+		return (0, a, 0, 0)
+
+def display(str, a, b, c, degree):
+	print("Équation :", str)
+	print ("\nÉquation réduite :")
+	if degree == 0: print(a, "= 0\nÉquation fausse."); exit()
+	if degree == 1:
+		print (a, "X", end = " "); sign(b); print(b, " = 0\naX + b = 0")
+	if degree == 2:
+		print (a, "X²", end = " "); sign(b); print(b, "X", end = " "); sign(c);
+		print (c, "= 0\naX² + bX + c = 0")
+	print ("Équation de degré polynomial", end = " "); print(int(degree), "\n")
+
+def	solve_degree_2(a, b, c):
+	delta = b**2 - 4 * a * c
+	print ("Calcul du discriminant :\nΔ = b² - 4ac\nΔ =", end = " ")
+	print (b, "² - 4 ×", a, "×", c, "\nΔ =", delta)
+	alpha = -b / (2 * a)
+	if delta > 0:
+		beta = ft_sqrt(delta) / (2 * a)
+		print ("Dicriminant scritement positif.\n\nCalcul des solutions :")
+		print ("     -b + √Δ\nX1 = ——————— =", end = " "); print_d(alpha + beta)
+		print("\n      2 × a\n\n     -b - √Δ\nX2 = ——————— =", end = " ")
+		print_d(alpha - beta); print("\n      2 × a")
+	if delta == 0:
+		print ("Discriminant nul.\n\nCalcul des solution :")
+		print ("      -b\nX = ——————— =", alpha, "\n     2 × a")
+	if delta < 0:
+		print ("Discriminant négatif.\n\nCalcul des solutions :")
+		xi = ft_sqrt(-delta) / (2 * a)
+		print ("     -b + i × √-Δ\nX1 = ————————————— =", end = " "); print_d(alpha)
+		sign(a); print_d (xi); print("× i\n         2 × a\n")
+		print ("     -b - i × √-Δ\nX2 = ————————————— =", end = " "); print_d(alpha)
+		if a <= 0: print("+", end = " ")
+		print_d (-xi); print ("× i\n         2 × a")
+
+if __name__ == '__main__':
+	if len(sys.argv) != 2: print("Entrez l’équation à résoudre."); exit()
+	str = sys.argv[1]
+	strp, eq, eq1, eq2 = parse(str)
+	degree = get_degree(eq)
+	degree, a, b, c = get_coef(eq1, eq2, degree)
+	display(str, a, b, c, degree)
+	if (degree == 1):
+		print ("Solution :\n    -b\nX = ——— =", end = " ");
+		print_d(-b / a); print("\n     a")
+	if (degree == 2): solve_degree_2(a, b, c)

+ 383 - 0
tv_correction

@@ -0,0 +1,383 @@
+  1 #!/usr/bin/env python3
+Last login: Tue Sep 29 15:06:18 on ttys010
+e3r6p20% cd /tmp
+e3r6p20% ls
+1G.rnd								com.apple.launchd.eQSrdSuVW1
+KSOutOfProcessFetcher.0.HVXI9pQwBk_bgiVJaTNhiQNhqxc=		com.apple.launchd.hlS6zzuHLH
+KSOutOfProcessFetcher.11304.HVXI9pQwBk_bgiVJaTNhiQNhqxc=	krb5cc_3HbHhC
+aa								krb5cc_UN0RBP
+com.apple.launchd.MmzwCGrmIt					munki_swupd_cache
+e3r6p20% git clone vogsphere@vogsphere.42.fr:intra/2015/activities/computorv1/mazimi tv
+Cloning into 'tv'...
+ 97     if degree == 0:
+vogsphere: (INFO) Transaction ID : 58c24104-a741-481b-87d8-f2873bfbaf16
+vogsphere: (INFO) Please mention this ID in any ticket you create concerning this transaction
+vogsphere: (INFO) This transaction has been started at 2015-09-29 15:38:28, server time.
+vogsphere: (INFO) Rights will be determined using this time, so do NOT cut the connection.
+vogsphere: (INFO) It appears you are mazimi. If that's not true, check your Kerberos tickets (klist)
+vogsphere: (INFO) You have read-only rights on this repository
+remote: Counting objects: 3, done.
+remote: Compressing objects: 100% (2/2), done.
+remote: Total 3 (delta 0), reused 0 (delta 0)
+Receiving objects: 100% (3/3), done.
+ch Checking connectivity... done.
+e3r6p20% cd tv
+e3r6p20% ls
+main.py
+e3r6p20% ls
+main.py
+e3r6p20%
+e3r6p20% ./main.py
+./main.py: line 13: import: command not found
+./main.py: line 14: import: command not found
+./main.py: line 16: syntax error near unexpected token `('
+./main.py: line 16: `def ft_sqrt (n):'
+e3r6p20% vim main.py
+e3r6p20% ls
+main.py
+e3r6p20% ./main.py
+Entrez l’équation à résoudre.
+e3r6p20% ./main.py "-3 * X ^ 0 = 0"
+Équation : -3 * X ^ 0 = 0
+
+Équation réduite :
+-3.0 X + 0.0  = 0
+  1 #!/usr/bin/env python3
+  2
+  3
+  4 # **************************************************************************** #
+  5 #                                                                              #
+  6 #                                                         :::      ::::::::    #
+  7 #    main.py                                            :+:      :+:    :+:    #
+  8 #                                                     +:+ +:+         +:+      #
+  9 #    By: mazimi <mazimi@student.42.fr>              +#+  +:+       +#+         #
+ 10 #                                                 +#+#+#+#+#+   +#+            #
+ 11 #    Created: 2015/04/22 13:13:05 by mazimi            #+#    #+#              #
+ 12 #    Updated: 2015/09/29 13:06:23 by mazimi           ###   ########.fr        #
+ 13 #                                                                              #
+ 14 # **************************************************************************** #
+ 15
+ 16 import sys
+ 17 import re
+ 18
+ 19 def ft_sqrt (n):
+ 20     a = 1
+ 21     for i in range(0, 10):
+ 22         a = 0.5 * (a + n / a)
+ 23     return (a)
+ 24
+ 25 def sign(a):
+ 26     if a >= 0: print("+", end = " ")
+ 27
+ 28 def print_d(n):
+ 29     print("{0:.3f}".format(round(n, 3)), end = " ")
+ 30
+ 31 def wrong_degree():
+ 32     print ("Je ne sait pas résoudre les équations de degré polynomial différent de un et deux.")
+ 33     exit()
+ 34
+ 35 def cond_X0(eq, i):
+ 36     if eq[i - 1] != "^" and "0" <= eq[i] and eq[i] <= "9":
+ 37         return (1)
+ 38
+ 39 def parse (str):
+ 40     i = 0
+ 41     while (i < len(str) - 2):
+ 42         if cond_X0(str, i) and str[i + 1] == " " and str[i + 2] != "*":
+ 43             a = str[:i + 1]; b = str[i + 1:]; s = "";
+ 44             seq = a, " * X^0", b; str = s.join(seq)
+ 45         i = i + 1
+ 46     if cond_X0(str, len(str) - 1):
+ 47         seq = str, " * X^0"; str = s.join(seq)
+ 48     if str[0] == "X": seq  = "1 * ", str; str = s.join(seq)
+ 49     if str[len(str) - 1] == "X":
+ 50         a = str[:len(str) - 1]; seq = a, "1 * X^1"; str = s.join(seq)
+ 51     str = str.replace("X ", "X^1 "); str = str.replace("+ X^", "+ 1 * X^")
+ 52     str = str.replace("- X^", "- 1 * X^"); str = str.replace("= X^", "= 1 * X^")
+main.py
+"main.py" 149L, 6048C
+ 51     str = str.replace("X ", "X^1 "); str = str.replace("+ X^", "+ 1 * X^")
+ 52     str = str.replace("- X^", "- 1 * X^"); str = str.replace("= X^", "= 1 * X^")
+ 53     eq1, eq2 = str.split("=")
+ 54     eq1 = re.split('(\-*\s*[\.0-9]*)\s\*\sX\^(\-*[0-9\.]*)', eq1)
+ 55     eq2 = re.split('(\-*\s*[\.0-9]*)\s\*\sX\^(\-*[0-9\.]*)', eq2)
+ 56     eq = re.split('(\-*\s*[\.0-9]*)\s\*\sX\^(\-*[0-9\.]*)', str)
+ 57     strp = str
+ 58     return (strp, eq, eq1, eq2)
+ 59
+ 60 def get_degree(eq):
+ 61     degree = 1
+ 62     for i in range(2, len(eq), 3):
+ 63         d = float(eq[i])
+ 64         if (d != 0 and d != 1 and d != 2 and d != 3): wrong_degree()
+ 65         if degree < d: degree = d
+ 66     return (degree)
+ 67
+ 68 def get_coef(eq1, eq2, degree):
+ 69     a, b, c, d = 0, 0, 0, 0
+ 70     if degree == 3:
+ 71         for i in range(2, len(eq1), 3):
+ 72             if eq1[i] == "3": d2 = eq1[i - 1]; d = d + float(d2.replace(" ", ""))
+ 73         for i in range(2, len(eq2), 3):
+ 74             if eq2[i] == "3": d2 = eq2[i - 1]; d = d - float(d2.replace(" ", ""))
+ 75         if d == 0: degree = 2
+ 76         else: wrong_degree()
+ 77     if degree == 2:
+ 78         for i in range(2, len(eq1), 3):
+ 79             if eq1[i] == "0": c2 = eq1[i - 1]; c = c + float(c2.replace(" ", ""))
+ 80             if eq1[i] == "1": b2 = eq1[i - 1]; b = b + float(b2.replace(" ", ""))
+ 81             if eq1[i] == "2": a2 = eq1[i - 1]; a = a + float(a2.replace(" ", ""))
+ 82         for i in range(2, len(eq2), 3):
+ 83             if eq2[i] == "0": c2 = eq2[i - 1]; c = c - float(c2.replace(" ", ""))
+ 84             if eq2[i] == "1": b2 = eq2[i - 1]; b = b - float(b2.replace(" ", ""))
+ 85             if eq2[i] == "2": a2 = eq2[i - 1]; a = a - float(a2.replace(" ", ""))
+ 86         if a == 0: return (1, b, c, 0)
+ 87         return (degree, a, b, c)
+ 88     if degree == 1:
+ 89         for i in range(2, len(eq1), 3):
+ 90             if eq1[i] == "0": b2 = eq1[i - 1]; b = b + float(b2.replace(" ", ""))
+ 91             if eq1[i] == "1": a2 = eq1[i - 1]; a = a + float(a2.replace(" ", ""))
+ 92         for i in range(2, len(eq2), 3):
+ 93             if eq2[i] == "0": b2 = eq2[i - 1]; b = b - float(b2.replace(" ", ""))
+ 94             if eq2[i] == "1": a2 = eq2[i - 1]; a = a - float(a2.replace(" ", ""))
+ 95         if a == 0: return (0, b, 0, 0)
+ 96         return (degree, a, b, 0)
+ 97     if degree == 0:
+ 98         for i in range(2, len(eq1), 3): a2 = eq1[i - 1]; a = a + float(a2.replace(" ", ""))
+ 99         for i in range(2, len(eq2), 3): a2 = eq2[i - 1]; a = a - float(a2.replace(" ", ""))
+100         return (0, a, 0, 0)
+101
+102 def display(str, a, b, c, degree):
+main.py
+aX + b = 0
+Équation de degré polynomial 1
+
+Solution :
+    -b
+X = ——— = 0.000
+     a
+e3r6p20% ./main.py "-3 * X^0 = 0"
+Traceback (most recent call last):
+  File "./main.py", line 139, in <module>
+    strp, eq, eq1, eq2 = parse(str)
+  File "./main.py", line 47, in parse
+    seq = str, " * X^0"; str = s.join(seq)
+UnboundLocalError: local variable 's' referenced before assignment
+e3r6p20% ./main.py "-3 * X^0 = 0 * X^0"
+Équation : -3 * X^0 = 0 * X^0
+
+Équation réduite :
+-3.0 = 0
+Équation fausse.
+e3r6p20% vim main.py
+e3r6p20% ./main.py "-3 * X^0 = 0 * X^0"
+Équation : -3 * X^0 = 0 * X^0
+
+Équation réduite :
+-3.0 = 0
+Équation fausse.
+Je ne crasherai pas
+e3r6p20% ./main.py "-3 * X^0 = 0 * X^ aeokfdb0"
+]pJe ne crasherai pas
+Traceback (most recent call last):
+  File "./main.py", line 149, in <module>
+    if (degree == 2): solve_degree_2(a, b, c)
+NameError: name 'degree' is not defined
+e3r6p20% ./main.py "-3 * X^0 = -3 * X^0"
+Équation : -3 * X^0 = -3 * X^0
+
+Équation réduite :
+0.0 = 0
+Équation fausse.
+Je ne crasherai pas
+e3r6p20% ./main.py "-3 * X^3 = -3 * X^3"
+Équation : -3 * X^3 = -3 * X^3
+
+Équation réduite :
+0 X + 0  = 0
+aX + b = 0
+Équation de degré polynomial 1
+
+Solution :
+    -b
+X = ——— = Je ne crasherai pas
+e3r6p20% vim main.py
+e3r6p20% ./main.py "-3 * X^3 = -3 * X^3"
+Équation : -3 * X^3 = -3 * X^3
+
+Équation réduite :
+0 X + 0  = 0
+aX + b = 0
+Équation de degré polynomial 1
+
+Solution :
+    -b
+X = ——— = %                                                                                                                                                 e3r6p20% git stash
+Saved working directory and index state WIP on master: 10a17ba Add file
+HEAD is now at 10a17ba Add file
+e3r6p20% ./main.py "-3 * X^3 = -3 * X^3"
+./main.py: line 13: import: command not found
+./main.py: line 14: import: command not found
+./main.py: line 16: syntax error near unexpected token `('
+./main.py: line 16: `def ft_sqrt (n):'
+e3r6p20% python3 main.py "-3 * X^3 = -3 * X^3"
+Équation : -3 * X^3 = -3 * X^3
+
+Équation réduite :
+0 X + 0  = 0
+aX + b = 0
+Équation de degré polynomial 1
+
+Solution :
+    -b
+X = ——— = Traceback (most recent call last):
+  File "main.py", line 142, in <module>
+    print_d(-b / a); print("\n     a")
+ZeroDivisionError: division by zero
+e3r6p20% python3 main.py "-3 * X^2 = -3 * X^2"
+Équation : -3 * X^2 = -3 * X^2
+
+Équation réduite :
+0 X + 0  = 0
+aX + b = 0
+Équation de degré polynomial 1
+
+Solution :
+    -b
+X = ——— = Traceback (most recent call last):
+  File "main.py", line 142, in <module>
+    print_d(-b / a); print("\n     a")
+ZeroDivisionError: division by zero
+e3r6p20% python3 main.py "-3 * X^2 = -3 * X^0"
+Équation : -3 * X^2 = -3 * X^0
+
+Équation réduite :
+-3.0 X² + 0 X + 3.0 = 0
+aX² + bX + c = 0
+Équation de degré polynomial 2
+
+Calcul du discriminant :
+Δ = b² - 4ac
+Δ = 0 ² - 4 × -3.0 × 3.0
+Δ = 36.0
+Dicriminant scritement positif.
+
+Calcul des solutions :
+     -b + √Δ
+X1 = ——————— = -1.000
+      2 × a
+
+     -b - √Δ
+X2 = ——————— = 1.000
+      2 × a
+e3r6p20% python3 main.py "1 * X^0 - 2 * X^1 + 8 * X^2 = 0"
+Traceback (most recent call last):
+  File "main.py", line 136, in <module>
+    strp, eq, eq1, eq2 = parse(str)
+  File "main.py", line 44, in parse
+    seq = str, " * X^0"; str = s.join(seq)
+UnboundLocalError: local variable 's' referenced before assignment
+e3r6p20% python3 main.py "1 * X^0 + 2 * X^1 + 8 * X^2 = 0"
+Traceback (most recent call last):
+  File "main.py", line 136, in <module>
+    strp, eq, eq1, eq2 = parse(str)
+  File "main.py", line 44, in parse
+    seq = str, " * X^0"; str = s.join(seq)
+UnboundLocalError: local variable 's' referenced before assignment
+e3r6p20% python3 main.py "1 * X^0 - 2 * X^1 + 8 * X^2 = 0 * X^0"
+Équation : 1 * X^0 - 2 * X^1 + 8 * X^2 = 0 * X^0
+
+Équation réduite :
+8.0 X² -2.0 X + 1.0 = 0
+aX² + bX + c = 0
+Équation de degré polynomial 2
+
+Calcul du discriminant :
+Δ = b² - 4ac
+Δ = -2.0 ² - 4 × 8.0 × 1.0
+Δ = -28.0
+Discriminant négatif.
+
+Calcul des solutions :
+     -b + i × √-Δ
+X1 = ————————————— = 0.125 + 0.331 × i
+         2 × a
+
+     -b - i × √-Δ
+X2 = ————————————— = 0.125 -0.331 × i
+         2 × a
+e3r6p20% python3 main.py "1 * X^0 - 2 * X^1 + 8 * X^2 + 4 * X^5 = 0 * X^0 + 4 * X^5"
+Je ne sait pas résoudre les équations de degré polynomial différent de un et deux.
+e3r6p20% python3
+Python 3.4.3 (v3.4.3:9b73f1c3e601, Feb 23 2015, 02:52:03)
+[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
+Type "help", "copyright", "credits" or "license" for more information.
+>>> list = []
+>>> [].append('salut', 42)
+Traceback (most recent call last):
+  File "<stdin>", line 1, in <module>
+TypeError: append() takes exactly one argument (2 given)
+>>> [].append(('salut', 42))
+>>> [].append(('coucou', 777))
+>>> list
+[]
+>>> for elem in list
+  File "<stdin>", line 1
+    for elem in list
+                   ^
+SyntaxError: invalid syntax
+>>> for elem in list:
+...
+  File "<stdin>", line 2
+
+    ^
+IndentationError: expected an indented block
+>>> for str,nb in list:
+... print('str: {}, nb: {}'.format(str, nb))
+  File "<stdin>", line 2
+    print('str: {}, nb: {}'.format(str, nb))
+        ^
+IndentationError: expected an indented block
+>>> for str,nb in list:
+... print('str: {}, nb: {}'.format(str, nb))
+Display all 188 possibilities? (y or n)
+...      print('str: {}, nb: {}'.format(str, nb))
+...
+>>> len(list)
+0
+>>> list.append(('salut', 42))
+>>> list.append(('coucou', 777))
+>>> len(list)
+2
+>>> for str,nb in list:
+...      print('str: {}, nb: {}'.format(str, nb))
+...
+str: salut, nb: 42
+str: coucou, nb: 777
+>>> list1 = [0, 3, 0, 0, 0, 5]
+>>> list2 = [3, 8, 0, 0, 0, 5]
+>>> sumlist = []
+>>> i = 0
+>>> for each in list1
+  File "<stdin>", line 1
+    for each in list1
+                    ^
+SyntaxError: invalid syntax
+>>> for each in list1:
+...
+Display all 194 possibilities? (y or n)
+...
+  File "<stdin>", line 2
+
+    ^
+IndentationError: expected an indented block
+>>> while i < (min(len(list1), len(list2))):
+...     sumlist.append(sum(list1[i] - list2[i]))
+...     i = i + 1
+...
+Traceback (most recent call last):
+  File "<stdin>", line 2, in <module>
+TypeError: 'int' object is not iterable
+>>> ^D
+e3r6p20%
+e3r6p20% python3

+ 6 - 0
while.sh

@@ -0,0 +1,6 @@
+i=1
+while [ $i -le 100 ]
+do
+	python3 main.py
+	(( i++ ))
+done