-
Notifications
You must be signed in to change notification settings - Fork 12k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Created a snippet to convert centimeters to inches
- Loading branch information
1 parent
dd693b2
commit 919c08e
Showing
1 changed file
with
21 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
title: Centimeter to Inch converter | ||
type: snippet | ||
language: python | ||
tags: [math] | ||
cover: blue-computer | ||
dateModified: 2023-09-21T09:48:37+05:30 | ||
--- | ||
|
||
Converts Centimeters to Inches | ||
|
||
- Follows the conversion formula `in = cm / 2.54` | ||
|
||
```py | ||
def centimeters_to_inches(centimeters): | ||
inches = centimeters / 2.54 | ||
return f"{inches:.2f}" | ||
``` | ||
|
||
```py | ||
centimeters_to_inches(15) # 5.91 |