Uncategorized
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”
Loops with “for”
Use of the conditional “if” and “else”/”elif”
This is an example from the challenge of the week I made with Carolina Vargas in class.
If is a condition, that states IF some parameters are accomplish then do something and is that IF doesn’t happen the you put ELSE, to do something ELSE… and if that ELSE doesn’t happen then you put another ELSE it’s just that now with ELIF because you can’t repeat the word ELSE.
Reading and writing of text files
In Python, you don’t need to import any library to read and write files.The first step is to get a file object.
The way to do this is to use the open function.
A file is usually categorized as either text or binary.
A text file is often structured as a sequence of lines and a line is a sequence of characters.
The line is terminated by a EOL (End Of Line) character.
The most common line terminator is the, or the newline character.
The backslash character indicates that the next character will be treated as a newline.
A binary file is basically any file that is not a text file. Binary files can only be processed by application that know about the file’s structure.
Creation and use of ranges in Python
Range is a variable used in python to select a “range” of values in a list or maybe an input.
Creation and use of dictionaries in Python
A simple creation of a dictionary
First name your dictionary variable:
f.e. “d1”
Then have clear which parameters will you put in your dictionary and put them inside {}
d1 = {“age”:18, “work”:student, “Name”: Jose Angel}
Creating & Using own modules/libraries.
To create and use you own modules you better code this:
import potato <- You can call you module whatever you want
potato.example (‘hello’) <-Then in parenthesis the output you want it to have
To install it in mac you use this command in the shell:
pip3 install <package>
and the you run your program on the shell and thats it.
It should print ‘Hello’
Libraries: Importing and using them
To import a library f.e. math you literally use the command import and followed by the library you want in this case math:
There a lots of Libraries/Dictionaries, you can even create your own ( it’s a lot of work obviously but sometimes necessary).
You can look up on google all the dictionaries that exist.
The results are these: