Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added kilometers to meters conversion capability

  • Loading branch information...
commit 93c1769d50f4219ba378d46df4f43f0a20050d3b 1 parent 8a34476
Aaron Hill authored
Showing with 12 additions and 2 deletions.
  1. +12 −2 kilometers.py
View
14 kilometers.py
@@ -25,6 +25,16 @@ def kilometers_decimeters(n):
print str(n) + ' kilometers = ' + str(b) + ' decimeter(s).'
quit()
+def kilometers_meters(n):
+ b = float(n) * 1000
+ if float(n) == 1:
+ print str(n) + ' kilometer = ' + str(b) + ' meter(s).'
+ quit()
+ else:
+ print str(n) + ' kilometers = ' + str(b) + ' meter(s).'
+ quit()
+
+
def kilometer():
try:
a = float(raw_input('How many kilometers would you like to convert? '))
@@ -38,7 +48,7 @@ def kilometer():
kilometers_centimeters(a)
elif b == 'D' or b == 'd':
kilometers_decimeters(a)
- #if b == 'Me' or b == 'me' or b == 'mE':
- # kilometers_meters(a)
+ elif b == 'Me' or b == 'me' or b == 'mE':
+ kilometers_meters(a)
#if b == 'K' or b == 'k':
#
Please sign in to comment.
Something went wrong with that request. Please try again.