<font size="4"><span style="color: rgb(204, 0, 0);">Hi everybody, I would appreciate your help on this one<br>In this program I want to create 2 concepts each with 2 or 3 properties<br>My first concept is magasin(shop in french) and my shop has 3 attributes: nom(name in french), items and ville (city in french)<br>
the second one is items and its 2 attributes are </span></font><font size="4"><span style="color: rgb(204, 0, 0);">nom(name in french) and prix (price in french)<br>I want to be able to show a modele with the name of my magasins (stores) and the city theyre located in, what are the names of the items i have in each magasin and their prices.<br>
<br></span></font><font size="4"><span style="color: rgb(204, 0, 0);">Here&#39;s my code:</span></font><br><br>class Magasin:<br>    &quot;&quot;&quot;<br>    Le concept magasin pour la gestion d&#39;inventaire des items de golf.<br>
    &quot;&quot;&quot;<br>    def __init__(self, nom =&quot;&quot;, items =[], ville=&quot;&quot; ):<br>        self.nom = nom<br>        self.items = items<br>        self.vile = ville<br>        <br>    def set_nom(self, nom):<br>
        self.nom = nom<br><br>    nom = property(None, set_nom)<br><br>    def set_items(self, items):<br>        self.items = items<br><br>    items = property(None, set_items)<br><br>    def set_ville(self, ville):<br>        self.ville = ville<br>
<br>    items = property(None, set_ville)<br><br>    def __str__(self):<br>        return self.nom<br><br>class Item:<br>    &quot;&quot;&quot;<br>    Le concept item pour la gestion d&#39;inventaire des items de golf.<br>
    &quot;&quot;&quot;<br>    def __init__(self, nom =&quot;&quot;, prix = 100):<br>        self.nom = nom<br>        self.prix = prix<br><br>    def set_nom(self, nom):<br>        self.nom = nom<br><br>    nom = property(None, set_nom)<br>
<br>    def set_prix(self, prix):<br>        self.prix = prix<br><br>    prix = property(None, set_prix)<br><br>    def __str__(self):<br>        return self.nom<br><br>class Modele:<br>    &quot;&quot;&quot;<br>    La definition d&#39;un modele avec les magasins.<br>
    &quot;&quot;&quot;<br>    def __init__(self, nom_fichier, magasins =[]):<br>        self.nom_fichier = nom_fichier<br>        self.magasins = magasins<br><br>    def set_nom_fichier(self, nom_fichier):<br>        self.nom_fichier = nom_fichier<br>
<br>    nom_fichier = property(None, set_nom_fichier)<br><br>    def set_magasins(self, magasins):<br>        self.magasins = magasins<br><br>    magasins = property(None, set_magasins)<br><br>    def sauvegarder(self):<br>
        modele_fichier = open(self.nom_fichier, &#39;w&#39;)<br>        for magasin in self.magasins:<br>            modele_fichier.write(&quot;===MAGASIN===&quot;  + &quot;\n&quot;)<br>            modele_fichier.write(&quot;nom : &quot; + magasin.nom + &quot;\n&quot;)<br>
            modele_fichier.write(&quot;items : &quot; + &quot;\n&quot;)<br>            for item in magasin.items:<br>                modele_fichier.write(&quot;    ---ITEM---&quot;  + &quot;\n&quot;)<br>                modele_fichier.write(&quot;    nom : &quot; + item.nom + &quot;\n&quot;)<br>
                modele_fichier.write(&quot;    prix : &quot; + item.prix + &quot;\n&quot;)<br>                modele_fichier.write(&quot;    ---FIN ITEM---&quot;  + &quot;\n&quot;)<br>            modele_fichier.write(&quot;===FIN MAGASIN===&quot;  + &quot;\n&quot;)<br>
        modele_fichier.close()<br><br>    def charger(self):<br>        magasins = []<br>        try:<br>            modele_fichier = open(self.nom_fichier, &#39;r&#39;)<br>        except IOError:<br>            print(&quot;Le fichier &quot; + self.nom_fichier + &quot; n&#39;existe pas.&quot;)<br>
        else:    <br>            fin_fichier = False<br>            while not fin_fichier:<br>                ligne = modele_fichier.readline()<br>                if ligne == &quot;&quot;:<br>                    self.set_magasins(magasins)<br>
                    modele_fichier.close()<br>                    fin_fichier = True<br>                    break    <br>                magasin = Magasin()<br>                items = []<br>                fin_magasin = False<br>
                while not fin_magasin:<br>                    ligne = modele_fichier.readline().strip()<br>                    if ligne.startswith(&quot;===FIN MAGASIN===&quot;):<br>                        magasin.set_items(items)<br>
                        magasins.append(magasin)<br>                        fin_magasin = True<br>                    elif ligne.startswith(&quot;nom&quot;):<br>                        nom = ligne.split(&#39;:&#39;)[1]<br>
                        magasin.set_nom(nom.strip())<br>                    elif ligne.startswith(&quot;---ITEM---&quot;):<br>                        item = Item()<br>                        fin_item = False<br>                        while not fin_item:<br>
                            ligne = modele_fichier.readline().strip()<br>                            if ligne.startswith(&quot;nom&quot;):<br>                                nom = ligne.split(&#39;:&#39;)[1]      <br>                                item.set_nom(nom.strip())<br>
                            elif ligne.startswith(&quot;prix&quot;):<br>                                prix = ligne.split(&#39;:&#39;)[1]    <br>                                item.set_prix(float())<br>                            elif ligne.startswith(&quot;---FIN ITEM---&quot;):<br>
                                items.append(item)<br>                                fin_item = True<br><br>    def vide(self):<br>        if self.magasins == []:<br>            return True<br>        else:<br>            return False<br>
<br>    def initialiser(self):<br>        <br>        magasin01 = Magasin (&quot;Swing de golf&quot;)<br>        <br>        magasin02 = Magasin (&quot;Golftown&quot;)<br>        <br>        magasin03 = Magasin (&quot;PointGolf&quot;)<br>
       <br><br>        item01 = Item (&quot;Ensemble de fers Titleist&quot;)<br>        item01.set_prix(&quot;1099.99&quot;)<br>        <br>        item02 = Item (&quot;Ensemble de fers Callaway&quot;)<br>        item02.set_prix(&quot;1299.99&quot;)<br>
        <br>        item03 = Item (&quot;Ensemble de fers Taylormade Burner Graphite&quot;)<br>        item03.set_prix(&quot;2499.99&quot;)<br>        <br>        item04 = Item (&quot;Ensemble de fers Cobra&quot;)<br>        item04.set_prix(&quot;999.99&quot;)<br>
        <br>        item05 = Item (&quot;Ensemble de fers Ping&quot;)<br>        item06.set_prix(&quot;1399.99&quot;)<br>        <br>        item06 = Item (&quot;Ensemble de fers Ben Hogan&quot;)<br>        item06.set_prix(&quot;1199.99&quot;)<br>
 <br>        items = [item01, item02, item03, item04, item05, item06]<br>        magasin01.set_items(items)<br><br>        self.set_magasins([magasin01])<br><br>        self.sauvegarder()<br><br>    def afficher(self):<br>
        print(&quot;&quot;)<br>        print(&quot;Magasins&quot;)<br>        for magasin in self.magasins:<br>            print(&quot;&quot;)<br>            print(magasin)<br>            for item in magasin.items:<br>                print(item)<br>
<br><br>if __name__ == &#39;__main__&#39;:      <br>    modele = Modele()<br>    nom_fichier = &quot;magasinmodele.txt&quot;<br>    modele.charger(nom_fichier)<br>    if modele.vide():<br>        modele.initialiser(nom_fichier)<br>
    modele.afficher()<br><br><font size="4"><span style="color: rgb(204, 0, 0);">And here&#39;s my error :</span></font><br><br>Traceback (most recent call last):<br>  File &quot;F:\School\University\Session 4\Programmation SIO\magasingolfmodele.py&quot;, line 187, in &lt;module&gt;<br>
    modele = Modele()<br>TypeError: __init__() takes at least 2 arguments (1 given)<br><br><br><font size="4"><span style="color: rgb(204, 0, 0);">Thank You!!!</span></font><br clear="all"><br>-- <br>Marc-O. Rompré<br><br>