import math import random #---------# #Variables# #---------# signes="+-*^/=" minVariables="abcdefghijklmnopqrstuvwxyz" majVariables="ABCDEFGHIJKLMNOPQRSTUVWXYZ" nombresL="0123456789" #----------# #Brouillons# #----------# ''' read [17,"x","+",7,"+",15,"=",0] reduire [17,"x","+",22,"=",0] 5x+3=7x+7 5x+7x=3+7 12x=10 12x-10=0 [17,"x","+",7,"=",0] theoriser [A,a,"+",B,"=",C] [A,a,"=",B] [A,a,"+",B,"=",C] #objectif samy [A,a,"+",B,"=",0] [A,a,"^",B,"+",C,"=",0] [A,a,"=",B] [A,a,"^",B+D"="0"] ''' #---------# #Fonctions# #---------# def main(equation): global listeSol equation=supprimerEspace(equation) global liste=read(equation) modele=theoriser(liste) resoudre(modele) print(equation) def lecture(equation): listeInit=[] for lettre in equation: if lettre in nombres: listeInit.append(int(lettre)) else: listeInit.append(lettre) i=0 fini=False while fini==False: fini=True for lettre in listeInit: if i+1 0 and liste[k] != "=": operation.append(liste[k]) del liste[i : len(liste) - 1] i+=1 for j in range(0, somme.len()): if operation[j] == "+": somme = somme + somme[j] if operation[j] == "-": somme = somme - somme[j] if operation[j] == "/": somme = somme / somme[j] if opération[j] == "*": somme = somme * somme[j] if operation[j] == 0: somme = somme[j] liste.append(somme) def resoudre(modele): [1,3] global listeSol=[] if modele == ["A","a","+","B","=","0"]: solution=resoudreAffine(liste,nombres) listeSol.append(solution) if liste == ["A","a","^","B","+","C","c","+","D","=","0"]: nerienfaire=0 def resoudreAffine(liste): A = float(nombres[0]) B = float(nombres[1]) solution = - B / A return solution #ne sert a rien def simplifier(): global liste global nombres if liste == ["A","a","+","B","=","C"]: liste = ["A","a","+","B","=","0"] nombres[1] = nombres[1] - nombres[2] del nombres[2] def supprimerEspace(equation): for indice in range(len(equation)): if equation[indice]==" ": del equation[indice] return(equation) #-------# #Actions# #-------# str(equation)=input("Equation: ") print("La liste solution est: ",solution)