Skip to main content

Convert Centimeters to Inches Python Programming | Python Program Conver...

YouTube Video Tutorial How to write a Python program to convert centimetres to inches

Formula to convert centimetres to inches


 

Explanation of this Python Program

This Python program prompts the user to enter a height in inches, converts it to centimeters, and then prints the converted value. It uses the conversion factor of 2.54 to perform the conversion and rounds the result to two decimal places before displaying it to the user.

Here's an explanation of the provided Python program line by line:

python
inches = float(input('Enter the Height in inches to convert into centimeters:'))
  • This line prompts the user to enter a height in inches and assigns the entered value to the variable inches.
  • The input() function is used to receive input from the user, and float() is used to convert the input into a floating-point number.
python
centimeters = inches * 2.54
  • This line calculates the equivalent value in centimeters by multiplying the inches variable by the conversion factor 2.54.
  • The result is assigned to the variable centimeters.
python
centimeters = round(centimeters, 2)
  • This line rounds the value in centimeters to two decimal places using the round() function.
  • The rounded value is then assigned back to the centimeters variable.
python
print(inches, 'Inches =', centimeters, 'Centimeters')
  • This line displays the result of the conversion to the user.
  • The print() function is used to output a formatted string that includes the original inches value, the equal sign, and the converted centimeters value.


Comments

Popular posts from this blog

Explain Main Difference Between System Software and Application Software

Topic: Explain Main Difference Between System Software and Application Software            Differentiate between system software and application software Before , explaining the main differences between application software and system software, let us know the definitions of Application software and System software with examples. What is System Software: System software is a set of programs to control all components of computer and to manage overall operations of computer system. Differences between System software and application software System software is used as a base to install and run all application software. Examples of system software include: Operating Systems, like Microsoft Windows, DOS, Unix and Linux Device Drivers like Device driver software of a Printer (found on CD normally provided with the printer) Utility Programs like AVAST anti virus, Disk Scanners and File Viewers etc. What is Applicat...

Explain Different Types of Data Processing and Advantages Disadvantages

Today we will discuss different types or levels of data processing in detail. Let us define Data processing first. DATA PROCESSING Data processing is the sequence of operations performed on data to convert it into useful information . These operations may be arithmetic, statistical or logical operations. We can arrange or classify data. We can send and receive data from one point to another. Explain different types of data processing TYPES OF DATA PROCESSING (OR) LEVELS OF DATA PROCESSING) There are three types of data processing . 1) Manual data processing 2) Mechanical data processing 3) Electronic data processing We may also use the term Levels of data processing. First level of data processing was manual data processing when there were no calculating devices (before the invention of calculators). Therefore all processing jobs were performed manually by hand with the help of pen , paper and mind. In second level of data processing, machines like calculat...

Explain Different Types Of Computer Networks - LAN, MAN, WAN

Explain different types of computer networks:(LAN,WAN,MAN) Today, we will discuss the main types of computer networks on the basis of the maximum distance covered where they can be accessed and operate. The main types of computer networks are: LAN, WAN, MAN Explain different types of computer networks 1.    LAN - Local-Area Network 2.    WAN - Wide-Area Network 3.    MAN - Metropolitan-Area Network 1)LAN (Local Area Network) What is LAN or Local Area Network LAN stands for Local Area Network . It covers a small area. Most LANs are used to connect computers in a single building or group of near buildings. A network contained within a relatively small area, such as a classroom, school, or single building, is commonly referred to as a local area network. Hundreds or thousands of computers may be connected through LAN . LANs are used in office buildings, college or university campus etc. Local Area Networks can t...