Skip to main content

A simple library for temperature unit conversion

Project description

ctof

A simple library for temperature unit conversion


ctof is a library that converts Celsius values to Fahrenheit and vice versa. ctof works with ints and floats, as well as lists, tuples and sets, allowing for multiple values to be converted at once.


Installation

pip install ctof

Make sure to import it as from ctof import ctof.

Functions

There are only two functions in the ctof library:

cel(value) Returns Fahrenheit value converted to Celsius.

fah(value) Returns Celsius value converted to Fahrenheit.

Examples

Convert an integer

from ctof import ctof

print(ctof.cel(32)) # Value is in Fahrenheit
# Output: 0.0
print(ctof.fah(0)) # Value is in Celsius
# Output: 32

Convert a float

print(ctof.cel(111.11))
# Output: 43.95
print(ctof.fah(38.6))
# Output: 101.48

Convert from a variable

var1 = 86
var2 = 38

print(ctof.cel(var1))
# Output: 30.0
print(ctof.fah(var2))
# Output: 100.4

Convert from list, tuple and set

mylist = [37, 38, 39]
mytuple = (86, 87, 88)
myset = {32, 64}

print(ctof.cel(mytuple))
# Output: (30.0, 30.555555555555557, 31.11111111111111)
print(ctof.fah(mylist))
# Output: [98.6, 100.4, 102.2]
print(ctof.fah(myset))
# Output: {89.6, 147.2}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

ctof-0.1.0-py3-none-any.whl (2.6 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page