WSQ02 of my Python Class

--Originally published at S' Nami Bog. Servitas Vitae

Ken told us throughout the semester that we should do the WSQ to gain experience since those exercises are of a higher difficult level.

The instructions as always were posted on Ken’s main website, here are the instructions:

Write a program that will prompt the user for a temperature in Fahrenheit and then convert it to Celsius. You may recall that the formula is C = 5 ∗ (F − 32)/9. Modify the program to state whether or not water would boil at the temperature given.

The instructions are pretty straight forward; write a program that will change the temperature by applying the formula that I learned since middle school back in 2012 (long time ago).

Here si the written code and Terminal running the code:

My good friend Eugene and mainly Rafael helped me out with this WSQ.

I saw Rafael’s blog and saw this video which helped me a lot ” https://www.youtube.com/watch?v=fEeuBLVIlTw ” I’m a person that needs visual stuff to learn instead of reading.

This WSQ was very entertaining since the United States of America are the only ones using this units, some memes out there call Fahrenheit Retard Units. I’m happy that physics in middle school was actually helpful and I never thought I was going to need this for a programming class.

Rivers, 2017


# WSQ 02- Temperature

--Originally published at マルコ

What to Do

Write a program that will prompt the user for a temperature in Fahrenheit and then convert it to Celsius. You may recall that the formula is C = 5 ∗ (F − 32)/9.

Modify the program to state whether or not water would boil at the temperature given. Your output might look like the following

Example Run

What is the temperature in Fahrenheit? 100

A temperature of 100 degrees Fahrenheit is 37 in Celsius

Water does not boil at this temperature (under typical conditions).

Temperature

Temperature2

Featured image:

http://www.pixiv.net/member_illust.php?mode=medium&illust_id=9545915

 


WSQ-02

--Originally published at Site Title

En esta ocasión se pide un programa que simplemente reciba la temperatura en grados Fahrenheit para que la convierta a Celsius y nos diga si la temperatura del agua hierve o no.

captura-de-pantalla-7

Ejecutado en Python:

captura-de-pantalla-8

Para realizar esta solución simplemente aplique conocimientos que ya dominaba previamente.

 


Temperature

--Originally published at Programming

In this post we are going to create a programm that convert Farenheit degrees to Celsius.

Here is the code:

captura-de-pantalla-2017-02-08-a-las-18-10-58

But let’s explain: First we define our function and indicate what we want it give us.  If you have doubts with the formula, I recomend you to check this link: http://www.pythonforbeginners.com/code-snippets-source-code/python-code-celsius-and-fahrenheit-converter

Then, we declate f that will be the way we call Farenheit. It is an int, and also and input, because we ask the user for the value of farenheit he want. With that, we continue declarating c, the way we are calling Celsius degrees. For this, we call our function that has the same name.

In this moment,  we already have the results and we only need to print them out.

Water boils at 100 ºC, right? so, now that we have or information in degrees we could tell this information to the user to. We use a conditional to indicate and after that, we just print the statement.

Finally, in this youtube video is the process I had explain in this blog: Fahrenheit to Celsius Program in Python

And this is how the code runs:

captura-de-pantalla-2017-02-08-a-las-18-11-41

?


Temperature!

--Originally published at Python learning

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


WSQ 02

--Originally published at Tomas Enciso

This program basically allows the user to enter any temperature in fahrenheit and this person would get how much is that in celsius and if water boils at that temperature.

First I made an input so the user can enter any temperature, after that I gave the program the formula to get celsius put of the number that the user entered which is, Celsius = 5 * (Fahrenheit – 32)/9, then if the final number in celsius was higher or equal to 100 the program would print how much was that in celsius and that water does boil at that temperature, if not then it would print the temperature in celsius and that water does not boil at that temperature.

heres the code:

screen-shot-2017-01-31-at-5-02-04-pm

and here’s the program actually running with both options:

Screen Shot 2017-01-31 at 5.03.00 PM.png

and there it is.


WSQo2 – Conditionals (use of if, else and elif; and nesting of conditionals) (Python3)

--Originally published at Elu's Blog

For this assignment this were the instructions:

Write a program that will prompt the user for a temperature in Fahrenheit and then convert it to Celsius. You may recall that the formula is C = 5 ∗ (F − 32)/9. Modify the program to state whether or not water would boil at the temperature given.

And this is what I achieved:

Captura de pantalla 2017-01-30 a la(s) 14.27.27.png

As it can be observed, there are the int() and input() functions that we already know, but I haven’t covered the if, else and elif statements. This are very easy to understand and code. When you say, “if I study, I’ll do well on my exam”, you have the conditional “if I study,” and the result “I’ll do well on my exam”. When coding, it’s really the same thing, in line 5  we can observe the conditional “if C >= 100:” (which can be read, “if C is equal or greater than 100”) and in line 6 we can observe the result ‘print(“Water boils at this temperature (under typical conditions)”)’. The “else” statement is what happens when the “if” conditional is not achieved. The “elif” works in a way that when the first conditional is not achieved, then you can have another conditional.

Also, to nest a conditional statement means to have the whole “if, elif (optional) and else” inside an “if”, an “elif” or an “else”. When you nest it it means that you write it as the “result”.

At the end, this code runs like this:

Captura de pantalla 2017-01-30 a la(s) 14.32.29.png

If my explanation wasn’t clear enough check this two links:

Python Course’s explanation

http://www.python-course.eu/python3_conditional_statements.php

The Basics – Python 3: Conditional Statements Example (RTE)

https://youtu.be/enEwTN0zeNk