Convert Kilometer in other Units coderinme

Convert Kilometer in other Units coderinme

Convert Kilometer in other Units
Before we begin writing the code, we should first know the relation between all these units.
So following the the required relations:
1 km = 1000 m
1 km = 3280.84 feet
1 km = 39370.10 inches
1 km = 100000 cm
Convert the distance from Km into cm ,m , inch & feet

#!/usr/bin/env python
dist = int(raw_input("Enter the Distance in 'KM': "))
meter = dist * 1000
foot = dist * 3280.84
inch = dist * 39370.10
cm = dist * 100000
print 'The distance ' , dist , ' Km is equal to: %d meters' %meter
print 'The distance ' , dist , ' Km is equal to: %.2f foots' %foot
print 'The distance ' , dist , ' Km is equal to: %.2f inches' %inch
print 'The distance ' , dist , ' Km is equal to: %d centimeters' %cm

For more programs on Python, visit our Python Coder Archives

Convert Kilometer in other Units coderinme

All rights reserved. No part of this Post may be copied, distributed, or transmitted in any form or by any means, without the prior written permission of the website admin, except in the case of brief quotations embodied in critical reviews and certain other noncommercial uses permitted by copyright law. For permission requests, write to the owner, addressed “Attention: Permissions Coordinator,” to the admin @coderinme

Leave a reply:

Your email address will not be published.