title: Dictionary - printing result multiple times?
body: <p>I'm coding this program but running it and typing "2" when I type a subject it doesn't print the result once but nine times. Where is the problem? 9 is the number of subjects in the list named <code>mat</code> so it's strictly connected. Now to check some files .txt as placeholder but I'd like also using the module <code>json</code>.</p>
  
  <pre><code>import os
  
  def spat():
      a=len(list(os.listdir('C:/Users/SUINO/Desktop/python/prob/cache/'+y)))
      print(a)
      b=100/(25-a)
      print(b)
  
  mat=["latino","greco","storia","latino","scienze","matematica","grammatica",
       "promessi sposi,","eneide"] #mat means subject
  
  c=input("Do you want to add a placeholder or calculate probabilties? 1|2: ")
  if c == "1":
      c=input("Insert a subject: ")
      c=c.lower
      if c in mat:
          name=input("Insert the name of the student: ")
          open('C:/Users/SUINO/Desktop/python/prob/cache/'+c+'/'+name+".txt")
      else:
          print("Materia non esistente!")
  if c == "2":
      y=input("Materia: ")
      y=y.lower()
      x={"latino":spat(),"greco":spat(),"eneide":spat(),"promessi sposi":spat(),
         "mate":spat(),"grammatica":spat(),"storia":spat(),"scienze":spat(),
         "inglese":spat(),}
  </code></pre>
  
  <p>The objective of the program is to calculate the probabilities of being interrogated using the files .txt that have as name the name of the student interrogated yet.</p>