BeginnersBook

  • Home
  • Java
    • Java OOPs
    • Java Collections
    • Java Examples
  • C
    • C Examples
  • C++
    • C++ Examples
  • DBMS
  • Computer Network
  • Python
    • Python Examples
  • More…
    • jQuery
    • Kotlin
    • WordPress
    • SEO
    • JSON
    • JSP
    • JSTL
    • Servlet
    • MongoDB
    • XML
    • Perl

Python Program to Convert Kilometers(km) to Miles(mi.)

By Chaitanya Singh | Filed Under: Python Examples

In this tutorial we will see how to convert Kilometers to Miles in Python.

Kilometers to Miles Conversion in Python

This program prompts the user to enter the value in Kilometers and converts it into Miles by multiplying the entered value with 0.621371 (1 Km = 0.621371 mi.).

# Program published on https://beginnersbook.com

# Program to convert Kilometers to Miles
km = int(input("Enter the value in kilometers: "))

# 1 Kilometre = 0.621371 Mile
ratio = 0.621371

# Converting km to mi.
mi = km * ratio

print("The entered value in Miles: ", mi)

Output:

Enter the value in kilometers: 10
The entered value in Miles:  6.21371

Python program to convert Kilometers to Miles

Related Python Examples:

1. Python program to swap two numbers
2. Python program to print Calendar
3. Python program to add two binary numbers
4. Python program to convert Decimal to Binary

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Python Tutorial

Introduction

  • Python Tutorial
  • Python Introduction
  • Install Python
  • PyCharm IDE Installation
  • Python in PyCharm
  • Python Comments
  • Python Variables
  • Python Keywords & Identifiers
  • Python data types

Flow Control

  • Python If
  • Python if..else
  • Python if..elif..else
  • Python Nested If
  • Python for loop
  • Python while loop
  • Python break
  • Python continue
  • Python pass

Python Functions

  • Python Functions
  • Python Recursion

Python Datatypes

  • Python Numbers
  • Python List
  • Python Strings
  • Python Tuple
  • Python Dictionary
  • Python Set

Python OOPs

  • Python OOP
  • Python Class & Object
  • Python Constructors

Python Examples

  • Python Programs

Copyright © 2012 – 2022 BeginnersBook . Privacy Policy . Sitemap