Temperature!

In this post I’m going to show a program that will convert a given temperature from Fahreinheit to Celsius, and then state whether or not the water would boil at this temperature.

To do this I decided to use a function. Even though it is not that necessary to do it like this, I thought it was a good way to start practicing using functions.

Defining a function in python looks like this:

function

You can read more about that from the page I got it from: http://hcc-cs.weebly.com/functions.html 

So, to solve this problem I defined the function like this:

def Celsius(x):
return 5*(x-32)/9

And this is how my whole problem ended up looking:

temperature

Which runs like this:

temperature_run

One thought on “Temperature!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s