[Tutor] Convert from meters to British length units.

Peter Otten __peter__ at web.de
Mon Sep 17 09:40:30 CEST 2012


Johny Rei wrote:

> Help out there folks,,.I'm completely lost on  how to make a program where
> you set a length given in meters and then compute and write out the
> corresponding length measured in inches,in feet, in yards, and in
> miles.Can anybody guide me here, By the example you may provide will be
> appreciated..,

Here's an example that converts days into seconds:

>>> days = float(raw_input("Days "))
Days 12.5
>>> print "That's %s seconds" % (days * 24 * 60 * 60)
That's 1080000.0 seconds

Can you understand how that works? Try to apply it to a meter to feet 
conversion and show us your code. 

Then we may look into the next step, converting meters into a combination of 
inches and feet.




More information about the Tutor mailing list