Advertisement
Dar954826

Tabelline[ITA].py

Nov 6th, 2014
138
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.94 KB | None | 0 0
  1. def tabe():
  2.  global a,b,c,d,e,f,g,h
  3.  import random,sys,os
  4.  BaseRandom=random.randint(-99999999999999999999,99999999999999999999)
  5.  BaseRandom=str(BaseRandom)+".txt"
  6.  a=[]
  7.  stri="Moltiplicazioni: \n"
  8.  b=input("Inserisci Tabellina: ")
  9.  b=int(b)
  10.  c=input("continua fino a: ")
  11.  c=int(c)
  12.  f=input("Salvare i dati?[1=Completo,0=no]: ")
  13.  try:
  14.   f=int(f)
  15.   print(f)
  16.  except TypeError:
  17.   f=0
  18.  print(type(f))
  19.  if f!=1:
  20.   bool("False")
  21.  elif f==1:
  22.   gi=bool("True")
  23.  print(gi)
  24.  if gi!=0:
  25.   g=input("Inserire nome file: ")
  26.   if g=="":
  27.    g=BaseRandom
  28.   else:
  29.    g=g+".txt"
  30.  d=0
  31.  while d<=c:
  32.   e=b*d
  33.   if gi:
  34.    stri=stri+str(b)+" * "+str(d)+" = "+str(e)+"\n"
  35.   else:
  36.    print("fail")
  37.   a.append(e)
  38.   print(str(b)+" * "+str(d)+" = "+str(e))
  39.   d=d+1
  40.  
  41.  if gi:
  42.   stri=stri+"Risultati:"+"\n"
  43.   stri=stri+str(a)
  44.  print(stri)
  45.  print("Numeri:")
  46.  print(a)
  47.  if gi:
  48.   filed=open(g,"w")
  49.   filed.write(stri)
  50.  
  51.  
  52.  
  53.  
  54. while True:
  55.  tabe()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement