Saturday, 2 March 2019

Convert Kilometres To Miles in Python

kilometers = 5.5
# To take kilometers from the user, uncomment the code below
kilometers = input("Enter value in kilometers")
# conversion factor
conv_fac = 0.621371
# calculate miles
miles = kilometers * conv_fac
print('%0.3f kilometers is equal to %0.3f miles' %(kilometers,miles))

Output:

5.500 kilometers is equal to 3.418 miles

0 Comments:

Post a Comment

Popular Posts

Categories

Android (21) AngularJS (1) Books (9) C (75) C# (4) C++ (81) Data Strucures (4) Downloads (1) Engineering (13) FPL (17) Hadoop (1) HTML&CSS (38) IS (25) Java (85) Leet Code (4) PHP (20) Python (201) R (69) Selenium Webdriver (2) Software (14) SQL (27)