Monthly Archives: January 2015

Mastery 15

Use of the Conditional “If”

Mastery 15

I made a video about how to use If =^.^=

Mastery 15

Use of the Conditional “If”

Mastery 15

I made a video about how to use If =^.^=

Temperature #WSQ05

1 min read

This program includes the conditionals if and else. Basically, you establish a condition, if it’s true the program will do a series of actions you want it to do and, if it’s false, will do other series of actions determined by you. The way to write conditionals is like this:

if(condition)

{

series of actions if true

}

else

{

series of actions if false

}

 

The program below asks the temperature in Farenheit, then it converts it to Celcius and finally it prints in the screen a text that says if the water boils or not, depending on the temperature the user introduced at the beginning.

Here’s the program executed introducing two temperatures, 32 ºF (water does not boil at this temperature) and 212 ºF (water boils at this temperature).

To complet this task, I consulted pages 33 and 34 of the book “How to think like a computer scientist” by Allen B. Downey.

Let’s Rock with PYTHON 3 XD

1 min read


Python installed, now it’s time to introduce myself to the world of programming, isn’t ?

 

Learn To Program 2015-01-31 12:13:00

WSQ05
La conversión de temperatura es muy importante. Existen muchas escalas de temperatura, pero las mas usadas: Fahrenheit, Celsius y Kelvin están en la punta; los grados Celsius utilizados casi a nivel global, lideran la lista; los grados Fahrenheit utilizados principalmente en Estados Unidos y los grados Kelvin por las ciencias básicas: física o química, por ser una escala absoluta.
Utilizando la formula: C = (F – 32)  podremos convertir cualquier cantidad de °F en °C, solo que hay que saberla colocar en el programa.
Realicé un video de como realicé el programa:
https://www.youtube.com/watch?v=nCM2-RZ32Do

**********************
Programa hecho en Python:
**********************
https://gist.githubusercontent.com/A01630323/6bea1f7c4daa2be354a6/raw/07ff77b8636eb8b052aa526e95fed8a0e44ea2e6/WSQ05

Despues realizaré un programa que transforme a todas las escalas de temperatura. Sera simple luego de realizar éste.

Learn To Program 2015-01-31 12:13:00

WSQ05
La conversión de temperatura es muy importante. Existen muchas escalas de temperatura, pero las mas usadas: Fahrenheit, Celsius y Kelvin están en la punta; los grados Celsius utilizados casi a nivel global, lideran la lista; los grados Fahrenheit utilizados principalmente en Estados Unidos y los grados Kelvin por las ciencias básicas: física o química, por ser una escala absoluta.
Utilizando la formula: C = (F – 32)  podremos convertir cualquier cantidad de °F en °C, solo que hay que saberla colocar en el programa.
Realicé un video de como realicé el programa:
https://www.youtube.com/watch?v=nCM2-RZ32Do

**********************
Programa hecho en Python:
**********************
https://gist.githubusercontent.com/A01630323/6bea1f7c4daa2be354a6/raw/07ff77b8636eb8b052aa526e95fed8a0e44ea2e6/WSQ05

Despues realizaré un programa que transforme a todas las escalas de temperatura. Sera simple luego de realizar éste.

Learn To Program 2015-01-31 11:50:00

WSQ03
Esta nueva práctica consiste en resolver las operaciones matemáticas básicas (suma, resta, multiplicación, división y módulo)
No es tan difícil como esperaba, pero la clave está en saber el tipo de variables que manejaran los datos. Realicé un video de como elabore la actividad de manera muy rápida, tratando de abarcar todas las partes del problema.
https://www.youtube.com/watch?v=97j1p4gV23Y

**********************
Programa hecho en Python:
**********************
https://gist.githubusercontent.com/A01630323/951f25ca33e3ec02b8ac/raw/0781469638f4a876a804137982fcc7924fa7a853/WSQ03

Learn To Program 2015-01-31 11:50:00

WSQ03
Esta nueva práctica consiste en resolver las operaciones matemáticas básicas (suma, resta, multiplicación, división y módulo)
No es tan difícil como esperaba, pero la clave está en saber el tipo de variables que manejaran los datos. Realicé un video de como elabore la actividad de manera muy rápida, tratando de abarcar todas las partes del problema.
https://www.youtube.com/watch?v=97j1p4gV23Y

**********************
Programa hecho en Python:
**********************
https://gist.githubusercontent.com/A01630323/951f25ca33e3ec02b8ac/raw/0781469638f4a876a804137982fcc7924fa7a853/WSQ03

Fun with numbers! #WSQ03

2 min read

This is a program that asks you for two numbers, you type them and then it calculates the sum, difference, product, division and the remainder of the division of the two numbers.Screenshot of my program

The first thing I did was to download a word processor called Notepad++, to write the code there and save it as a C++ source file. When saving the code, you need to give it the name you want and put at the end .cpp like this: yourprogram.cpp. This is necessary to enable the program to be compiled. Now that you named the file, you need to save it in the User’s folder located in: C:/cygwin/home/Users(your computer’s name). Now, open the Cygwin Terminal, write: g++ yourprogram.cpp and click enter. It won’t be compiled if your program have a sintax error and the black screen will return an error message, if it doesn’t have any, it won’t return anything, like in the image below.

Screenshot of cygwin terminal

Once your program is compiled, you can run it, just type: ./a.exe

and press Enter.

To save and run the code, I watched this video made by Mr. Ken Bauer.

https://www.youtube.com/watch?v=5lJ6evIAndo&list=PLhMUtn5hqperLvPZugufj25uy8KW9ZrNP&index=3

To write the code, I watched this one also made by Mr. Ken.

https://www.youtube.com/watch?v=JFncCPhD76M&feature=youtu.be&list=PLhMUtn5hqperLvPZugufj25uy8KW9ZrNP

In this video he explains how to print messages in the screen by using the object cout and this arrows << and he also explains how to save the input (what the person types), as a variable by using the objetc cin and the arrows >>.

I also consulted the pages 4-8 of the book ”How to think like a computer scientist” written by Allen B. Downey.

 

 

#mastery15 y #mastery16

2 min read

Primero se debe de llamar a la librería iostream, y así poder utilizar datos de entrada y salida.

También se debe de definir el using namespace std.

Una vez esto, se debe de introducir el programa principal, el int main.

Se deben de definir las variables.

Después, se debe de preguntar por la edad.

Luego se introduce la primera condición if.

Un if, debe de seguir el siguiente formato.

Escribir if, y entre parentesís escribir la condición que se desea escribir, seguido de llaves { para luego escribir lo que se desea hacer en esa condicón. Al final, se debe de cerrar la llave } para indicar que se ha terminado lo programado en esa sección/condición.

Si se desea poner solamente dos condiciones en el programa, el siguiente debe de ser una condición else. En esta condición, solamente se cumple si la anterior (if) no lo hace. Su formato solo varía en escribir else en lugar de if, y no se necesita escribir una condición, porque el programa abarca todo el rango que no lo hizo el if.

Si se desean escribir más de dos condiciones, el formato de estas es la misma que del if, solo que en lugar de escribir if, se escribe else if, y todo lo demás igual, la condición que se desea en parentesís, las llaves y el programa.

Al final se compila y se corre el programa.

Aquí el código:

https://github.com/LuluisAngel/mastery-15-and-16/blob/master/README.md