Advertisement
Dar954826

Tables[ENG].py

Nov 6th, 2014
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.91 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="Multiplication: \n"
  8.  b=input("Enter multiplication table: ")
  9.  b=int(b)
  10.  c=input("Continues until: ")
  11.  c=int(c)
  12.  f=input("Save the data?[1=yes,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("Insert file name: ")
  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.   a.append(e)
  36.   print(str(b)+" * "+str(d)+" = "+str(e))
  37.   d=d+1
  38.  
  39.  if gi:
  40.   stri=stri+"Results:"+"\n"
  41.   stri=stri+str(a)
  42.  print(stri)
  43.  print("Numbers:")
  44.  print(a)
  45.  if gi:
  46.   filed=open(g,"w")
  47.   filed.write(stri)
  48.  
  49.  
  50.  
  51.  
  52. while True:
  53.  tabe()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement