Creation and use of Lists/Tuples (Python)

  • Lists are what they seem – a list of values. Each one of them is numbered, starting from zero – the first one is numbered zero, the second 1, the third 2, etc. You can remove values from the list, and add new values to the end. Example: Your many cats’ names.
  • Tuples are just like lists, but you can’t change their values. The values that you give it first up, are the values that you are stuck with for the rest of the program. Again, each value is numbered starting from zero, for easy reference. Example: the names of the months of the year.

Here’s a really good page to learn about them: http://sthurlow.com/python/lesson06/

Basically, you create lists when you can delete values, and change then as you wish in your code and tuples do not let you do this, they are constants we could say.

Creation and use of strings

Strings are extremely useful in python programming, they can arrange data, return frases with data the user inputs, and several more things but in its most basic way you crate variables and ask the program to return whatever you want it to return.

potato1:’I love Canada’

potato2:’I hate Trump’

those are our variables, potato 1 and 2.

then we can ask the program to return part of the sentence as we know counting from zero (zero=one, the first word in the sentence)

print potato1[0:]

print potato2[6:]

Potato 1 will return ‘I love Canada’ and potato 2 will return ‘Trump’

Use of recursion for repetitive algorithms

I saw this on: http://kenscourses.com/tc101winter2015/2015/use-of-recursion-for-repetitive-algorithms-6/

Basically, recursion in computer science is a method where the solution to a problem is based on solving smaller instances of the same problem.

Captura de pantalla 2016-11-07 a las 18.41.29.png

Recursion is multiplying n times n-1’s factorial f.e. if you choose 4 then the answer is 4×3! so its 4x3x2x1

Validated user input (ensure correct/expected data entry)

To ensure the expected entry is correct you need to use a nested statement, so the program ensures the user input is exactly how you want it (well…the program).

Captura de pantalla 2016-11-07 a las 17.45.52.png

The program uses float bc there can be a positive or negative number in the input, then allows the user to write something with the input function, then as the comment says, it checks if the number is positive, negative or zero and prints whatever it is depending on the input.

My experience with the class

So far It has been a tough semester, too many things to do and strict teachers, but this class makes me feel I can do things, mamy classes make feel a lot of students inferior and dumb just because they don’t understand at the same rate other students do, this class you can learn inside the classroom and outside of it knowing you will learn because the teacher gives you the outline and you see the topics at your own rate, but you are sure that you will work on them, even if it’s the last day before the exam, but you do them because it’s fun and you care about what your career is about, It’s been so long a good experience for a rookie programmer, I still have thousands of things to learn from Ken and pther teachers, about programming, technology, etc. but I think this was a good start.

Loops with “while”

This means that, while a numbers or a variable has a value, the program will keep following the action that it has to do

This flowchart explains it, it will keep going only “while” its true, it just needs one time to be wrong to stop doing whatever it does.