Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCristhofer Travieso <cristhofert97@gmail.com>2012-08-11 18:30:21 (GMT)
committer Cristhofer Travieso <cristhofert97@gmail.com>2012-08-11 18:30:21 (GMT)
commit3c74aef3fd9719baab75126cfbaaac66d69a8662 (patch)
treec185a39739596d2e7ca5eccbf1957efd708f7b4e
parentb7e06a31417b35d7ea6282a0a7681aff51399ce6 (diff)
cree una interfas de linea
-rw-r--r--.gitignore2
-rw-r--r--convert.py41
-rwxr-xr-x[-rw-r--r--]convertline.py22
3 files changed, 42 insertions, 23 deletions
diff --git a/.gitignore b/.gitignore
index f26f7c5..568ed0e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,4 +2,4 @@
*.pyo
*.mo
*~
-
+*.txt
diff --git a/convert.py b/convert.py
index 147df97..c18e8b3 100644
--- a/convert.py
+++ b/convert.py
@@ -18,35 +18,44 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-lenght = {'Meter': 1, 'Kilometer': 0.001, 'Centimeter': 0.01, 'Yard': 1.09361,
- 'Foot': 3.28084, 'Fathoms': 0.5468, 'mm': 0.001, 'dm': 0.1, 'dam': 10,
- 'hm': 100}
+lenght = {'m': 1, 'km': 1000, 'cm': 0.01, 'mm': 0.001,
+ 'dm': 0.1, 'dam': 10, 'hm': 100}
speed = {'Km/H': 1}
-area = {'Meter2': 1, 'Kilometer2': 0.001, 'Centimeter2': 100, 'Yard2': 1.09361,
- 'Foot2': 3.28084, 'Fathoms2': 0.5468, 'mm2': 1000, 'dm2': 10,
- 'dam2': 0.1, 'hm2': 0.01}
-
-weight = {'Gram': 1, 'hg': 0.01, 'dag': 0.1, 'dg': 10, 'cg': 100, 'mg': 1000,
- 'Kilogram': 1000}
+area = {'Meter2': 1}
-volume = {'Meter3': 1, 'Kilometer3': 0.001, 'Centimeter3': 100,
- 'Yard3': 1.09361, 'Foot3': 3.28084, 'Fathoms3': 0.5468, 'mm3': 1000,
- 'dm3': 10, 'dam3': 0.1, 'hm3': 0.01, 'Liter': 1, 'Kiloliter': 0.001,
- 'Centiliter': 100, 'ml': 1000, 'dl': 10, 'dal': 0.1, 'hl': 0.01}
+weight = {'Gram': 1}
+volume = {'Meter3': 1}
temp = {'Celsius': 1}
dic = lenght
-def convert(number, unit, to_unit):
- return number * dic[unit] * dic[to_unit]
+def convert(number, unit):
+ metro = number * dic[unit]
+ return str(metro) + 'm'
+
+# print '%s * %s * %s' % (number, dic[unit], dic[to_unit ])
+# return number * dic[unit] * dic[to_unit]
+# x = number * 1 / dic[unit]
+# a = x * dic[to_unit] / 1
+# return a
+
+# print number, dic[unit], dic[to_unit]
+# return number * dic[unit] * dic[to_unit]
+# 100cm ___ 1m
+# number ___ x
+# x = number * 1m / 100cm
+# x = number / dic[to_unit]
+#1m __ 1000mm
+#x ____ a
+#a = x * 1000mm / 1m
+#ATENCION! buscar por que en losnumeros aparese e-
# def convert(self):
# number = self.spin_btn.get_value()
# unit = self._get_active_text(self.combo1)
diff --git a/convertline.py b/convertline.py
index 5e923b4..ec55799 100644..100755
--- a/convertline.py
+++ b/convertline.py
@@ -18,12 +18,22 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+import os
+import sys
import convert
-print '*********convert*********'
-print convert.lenght.keys()
-unit = raw_input('Ingresa una medida: ')
-to_unit = raw_input('Ingresa la tra medida: ')
-number = input('Ingresa el numero: ')
-print convert.convert(number, unit, to_unit)
+estado = True
+
+while estado:
+ os.system('clear')
+ print '*********convert*********'
+ print convert.lenght.keys()
+ number = input('No.: ')
+ unit = raw_input('unidad : ')
+
+ print convert.convert(number, unit)
+ if raw_input('Deseas salir(y/n): ') == 'y':
+ sys.exit()
+ else:
+ estado = True