Advertisement
Dar954826

Scientific notation[ENG].py

Jan 14th, 2015
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.06 KB | None | 0 0
  1. def nota():
  2.  def void():
  3.   print("\n"*1000)
  4.  import string
  5.  bol=True
  6.  try:
  7.   m=string.punctuation
  8.   m=m.replace(".","")
  9.   c="10"
  10.   a=input("Insert the number: ")
  11.   if a=="":
  12.    import dlkjfg
  13.   for kjkj in string.ascii_letters:
  14.    if a.count(kjkj)!=0:
  15.     6/0
  16.   for kjkjk in m:
  17.    if a.count(kjkjk)!=0:
  18.     6/0
  19.   if a.count(".")==0:
  20.    a=a[:1]+"."+a[1:]
  21.    b=a.find(".")  
  22.    d=(a[b+1:len(a)-1])
  23.    for l in range(len(d)):
  24.     c=c+"0"
  25.    e=str(c.count("0"))
  26.    print(a+" * 10^"+e)
  27.   else:
  28.    if a[0]!="." and a[0]!="0":
  29.     print(a+" * 10^0")
  30.     bol=False
  31.    w=2
  32.    q=a.find(".")
  33.    if q==0:
  34.     a="0"+a
  35.    while True:
  36.     if a[w]=="0":
  37.      w=w+1
  38.     else:
  39.      break
  40.    r=a[w:len(a)]
  41.    t=len(a)-(len(r)-1)
  42.    for ll in range(t):
  43.     c=c+"0"
  44.    u=str(c.count("0")-3)
  45.    r=r[:1]+"."+r[1:]
  46.    if bol:
  47.     print(r+" * 10^-"+u)
  48.   input("Enter to delete.")
  49.   void()
  50.  except ZeroDivisionError:
  51.   input("You may not post lettere.Invio to Cancel.")
  52.   void()
  53.  except ImportError:
  54.   input("Enter a number.")
  55.   void()
  56. while True:
  57.  nota()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement