Skip to content

Commit

Permalink
Created a snippet to convert inches to centimeters
Browse files Browse the repository at this point in the history
  • Loading branch information
AnirudhRevanur committed Sep 21, 2023
1 parent 14e99c4 commit dd693b2
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions snippets/python/s/inch-to-cm.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
title: Inch to Centimeter converter
type: snippet
language: python
tags: [math]
cover: dark-city
dateModified: 2023-09-21T09:38:54+05:30
---

Converts Inches to Centimeters

- Follows the conversion formula `cm = in * 2.54`.

```py
def inches_to_centimeters(inches):
centimeters = inches * 2.54
return f"{centimeters:.2f}"
```

```py
inches_to_centimeters(15) # 38.10
```

0 comments on commit dd693b2

Please sign in to comment.