Permalink
Browse files

Added kilometers to decimeters conversion capability

  • Loading branch information...
Aaron Hill
Aaron Hill committed Apr 20, 2012
1 parent 9b32bfa commit 8a34476075d83f125e760d6e342a3f6a0059215c
Showing with 11 additions and 2 deletions.
  1. +11 −2 kilometers.py
View
@@ -16,6 +16,15 @@ def kilometers_centimeters(n):
print str(n) + ' kilometers = ' + str(b) + ' centimeter(s).'
quit()
+def kilometers_decimeters(n):
+ b = float(n) * 10000
+ if float(n) == 1:
+ print str(n) + ' kilometer = ' + str(b) + ' decimeter(s).'
+ quit()
+ else:
+ print str(n) + ' kilometers = ' + str(b) + ' decimeter(s).'
+ quit()
+
def kilometer():
try:
a = float(raw_input('How many kilometers would you like to convert? '))
@@ -27,8 +36,8 @@ def kilometer():
kilometers_millimeters(a)
elif b == 'C' or b == 'c':
kilometers_centimeters(a)
- #if b == 'D' or b == 'd':
- # kilometers_decimeters(a)
+ elif b == 'D' or b == 'd':
+ kilometers_decimeters(a)
#if b == 'Me' or b == 'me' or b == 'mE':
# kilometers_meters(a)
#if b == 'K' or b == 'k':

0 comments on commit 8a34476

Please sign in to comment.