#WSQ05

 

With this program I learned the basics of the conditionals in python.

The if, elif and else are functions that evaluate certain conditions and if such condition is true, the program executes a certain code, that code would be the statement of the condition. There can be multiple if, elif and else in your code. 

This page is helpful for understandig this concept- https://docs.python.org/3.5/tutorial/controlflow.html

 

For this program we have to ask the user for a temperature in Farenheit. Then the program has to convert that value to a temperature in Celsius. Also we have to tell the user if water boils or doesn´t at that temperature

The formula for converting Celsius to Farenheit is:

Cº= 5*(Fº-32)/9

Doing that is the first part of the code, and probably the easiest part. 

print (“What is the temperature in Farenheit?”)
temp=input()
deg=”degrees”
cel= 5*(int(temp)-32)//9
print (“The temperature in Celsius is:”, cel, deg)

The next part requires the use of the if and else functions.

if cel < 100 and cel > 0:
print (“Water does not boil at this temperature (under typical conditions).”)
if cel > 100:
print (“Water boils at this temperature (under typical conditions).”)
if cel<0:
print (“Water freezes at this temperature”)

The complete code would look like this:

 

temp

And the program running, like this:

 

temp2

 

 

WSQ05 – Temperature

Este trabajo consiste en una operación de conversión

Fahrenheit a Celsius.

fc5ee462-88b2-462d-908e-34fd309c51bb

Para poder hacer esta conversión, ocupamos de una formula, la cual es la siguiente:             C = 5 ∗ (F − 32)/9. Se utilizó el tipo float por el hecho de que al momento de realizar casi cualquier conversión de F a C, dan como resultados números con sus decimales, y hace la conversión mucho mas exacta.

WSQ05 - Temperature

Esta actividad no me resultó complicada, ya que anteriormente se ha trabajado con este tipo de operaciones, lo único diferente, nuevo y complicado fue el incluir el IF.

Link GitHub: WSQ05 – Temperature

#WSQ05 – Temperature

In order to make this program work properly I use a str(input()) to make sure that the user only type in string and not any other character. Then the logic is simple, just by using some if and elif that validates the user choice, and an else at the end that display if the user enter an invalid character.

2016-02-18

Then I use a int (input()) just to make sure that the user type in a number and if the temperature that the user type in is higher than the boilling point of water, it will display that information and the final temperature.

2016-02-18 (1)

Remember that the if statement use a parameter as a condition defined by you, and when this is true the interpeter will run that part of the code and ignores all the code remaining. If the If statement is not true then it will pass to an elif statement when you can write another condition, at the end an else statement is used as the default option if not of the above is true. (if x<y:) and do not forget to ident well

#TC101

I drank some boiling water cause I wanted to whistle…. Jk of course 😁

For this assignment we had to 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.

I actually didn’t have any problems because as I said before I have programmed before in C++ so this one is a piece of cake.

Here are the two possible situations ran in my terminal:

Haga click para ver el pase de diapositivas.

Here is the github link to my “Temperature” code → https://github.com/mfcanov/Temperature.git

Temperature WSQ05

Hello!! the task of today was simple, you have to declare variants, also you have to use “if” and “else”, the program will ask you for the temperature in fahrenheit and then the computer will calculate the temperature in celsius with this formula: C = 5 ∗ (F − 32)/9. As an addition of this task, you have to manipulate the code until the computer tell the user if the water boils at the temperature given (under typical conditions), here is an example:

Captura de pantalla 2016-02-10 a las 10.20.39 p.m.

If you don’t know how to use “if” and “else” here are some videos, it might be useful.

 

And finally, this is my code GitHub

WSQ05 – Checking Temperatures

We’re back on python and straight into our practices. You might wonder why I’m leaving WSQ04 undone, that’s because that practice isn’t really about coding but something more of an opinion essay. I really want to concentrate on the real work right now and then move on to that.

Today’s practice is about temperature’s units. The goal of this is to take a user input number as Fahrenheit degrees and transform it into Celsius units. So, here goes our first try :

———————————————————————-

Screen Shot 2016-02-10 at 1.46.18 PM

———————————————————————-

I’ll edit this later on.

 

Temperature F° to C°

This was a really easy to make program. For this WSQ I had to make a program that would allow the user to change a temperature in Fahrenheit to Celsius. And after that the program would say if water would boil or not at the temperature given.

For changing Fahrenheit to Celsius I just needed to write a program like the others but with the formula to change Fahrenheit to Celsious.temperaturepic

For saying if the water would boil or not I decided to used an if/else. If the temperature in C° was more than 100(temperature in which waters boils) it would say that in normal conditions, water would boil but if the result was a number smaller that 100 then it would say that water would not boil. 

You can see my program right here: Temperature

And this is the prove that it is working 😛 .temperaturecyg

I made this meme after finishing the program JAJAJAJ. ymtdo