#QUIZ02

Type in an integer and then raise it to the power of another integer. r its like a joker variable only used to save the value o “a” in order to keep going inside the while loop, until the “b” its equal to one.

2016-02-19 (2)

The second program of the quiz, print the number the user type in, and returns the number of stars corresponding to the number the user wrotes. The trick its not doing the string “*” times de number, you need to find another way.

I used a while loop in order to append one by one star into the list, then another while loop to print the list, when an end=”” it means that it will print a space and not a new line.

2016-02-19 (3)

code:

https://www.dropbox.com/s/dx8zx7uiunz3wu2/quiz2-2.py?dl=0

https://www.dropbox.com/s/x9htbn5ss1lb153/quiz2-1.py?dl=0

 

#TC101

#WSQ07 – Sum of Numbers

This program will sum all the integers in a range provided by the user(low and high).

But the thing gets more intersting when you add a condition, what if the user enter the range flipped. My solution was simple, using another variable(joker) to keep rolling the values of the variables until the boundries are flipped.

2016-02-19

Also used a counter and a while loop, because you start at the lower value(once you flipped if needed) and you know that the point to stop will be de upper value, so you just keep to adding 1 to the lower value and keep adding it to the same lower value.

2016-02-19 (1)

At the end joker is equal to lower, because you need the original value of lower if you want to display to the user, just to remaind them, the range they provide.

code: https://www.dropbox.com/s/3yo77oervelor5x/wsq7-ran.py?dl=0

#TC101

#WSQ06 – Pick a Number

The main purpose of this program is that the user guess a number from 1 to 100. Display the user the number of tries  and it give you hints of low and high, close to the number.

The first thing you need to do is import the random library in order to generate a random number each time the program executes, this random number will be between 1 and 100. Also you need to use a counter staring at 0, later you will use it to display the number of times until the user guess the number.

2016-02-18 (4)

In this case I use a while loop because I know that the point to stop its when the guess of the user its equal to the random number, so as long as the guess of the user its different, the while loop will repeat but with several conditions using if, elif that includes when the number its out of both boundries and when the number is high or low.

2016-02-18 (2)

At the end when the user wins, the while loop ends and the random number is printed, the number of time you try as well.

2016-02-18 (3)

I did two runs, you can see the random number its not the same.

code:https://www.dropbox.com/s/2jt4unflqycacgs/wsq6-pick.py?dl=0

#TC101

#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

#WSQ04 – Flipped Learning / #AbolishGrades

Its very intersting concept to abolish grade, because sometimes you know all the stuff that you have seen in class but your grade does not match with you knowledge. If you want to learn you will do it no matter what, and if you want to lose your time youre gonna do it and its not the teacher fault if students didnt came with any doubts to the classroom. But by grading them you are adding compromise to just do the stuff in order to pass and not in order to learn.

#TC101

#WSQ02 – Hello World

This was an easy task. Write my code using atom and run it in the command prompt in order to print “Hello World”.

cd is the way the terminal understands that you want to switch to another folder in order to execute the code(the folder you save your code). Then you need to tell the terminal you want to run it using python version 3.5 (Python35) and calling the executable python.exe and the name of the code.

2016-02-04 (4)

#TC101