Permalink
Browse files

Added centimeters to kilometers conversion capability

  • Loading branch information...
1 parent 2e51d3b commit 77f9026f96a806f92186b1e0704524a73793c7a1 Aaron Hill committed Apr 18, 2012
Showing with 8 additions and 0 deletions.
  1. +8 −0 centimeters.py
View
@@ -20,6 +20,12 @@ def centimeters_meters(n):
print str(n) + ' centimeter = ' + str(b) + ' meter(s).'
else:
print str(n) + ' centimeters = ' + str(b) + ' meter(s).'
+def centimeters_kilometers(n):
+ b = float(n) / 1000
+ if float(n) == 1:
+ print str(n) + ' centimeter = ' + str(b) + ' kilometer(s).'
+ else:
+ print str(n) + ' centimeters = ' + str(b) + ' kilometer(s).'
def centimeter():
try:
@@ -34,3 +40,5 @@ def centimeter():
centimeters_decimeters(a)
if b == 'Me' or b == 'me' or b == 'mE':
centimeters_meters(a)
+ if b == 'K' or b == 'k':
+ centimeters_kilometers(a)

0 comments on commit 77f9026

Please sign in to comment.