Warning: The magic method Slickr_Flickr_Plugin::__wakeup() must have public visibility in /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php on line 152
‘#Mastery23’ Articles at TC101 Fall 2015, Page 2
Introduction to Programming Python and C++

Tag Archives: #Mastery23

Mastery 23 & 25

Mastery 23 – Creation and use of lists in Python Here’s WSQ10 in which I created and used a list. Mastery 25 – Creation and use of ranges in Python Here’s WSQ 14 in which is created and used a range in a for loop. You can algo assign it to a variable and use […]

Masteries 23 & 24

Creation and use of vectors in C++
Creation and use of arrays in C++

Lists

       A list is a sequence of values that are nested into one function. These elements can be strings, number, and even lists. You can have many types of elements within the same list, for example:


Colors = [ ‘red’, ‘blue’, ’yellow’ ]

Numbers = [ 1, 2, 3 ]

List = [ 4, [5, 6]]

Other = [ ‘red’, 2, [5, 6] ]


      As you can see, for creating a list you need to establish the name on the list followed by an equal sign (which means ‘assignment’). After the equal sign you start naming the elements included in the list. These elements are nested inside square brackets [] and separated by commas. If the element being established is a string, it needs to be between quotation marks.


      For printing the whole list you type the command print() and between the parenthesis you type the name of the list. For printing just one element of the list you type the command print() and between the parenthesis you type the name of the list followed by the number of the element between square brackets.



NOTE: The elements on a list are numbered starting from 0



      For knowing how many elements a list contains, you can use the command len(), between the parenthesis you type the name of the list.

     Also, you can change an element on a list by typing the name of the list followed by position of the element you want to change between square brackets. After that, you place the equal sign followed by the element you want to replace it with.

#Mastery23 – Creation and use of vectors in C++

This is about creating and using vectors in C++. A vector in c++, is used to store different values in different storage compartments. It works almost the same as an array, the only difference is that the storage space can change. This is one of the differences with the arrays that storage spaces have to be declared.

 

Vectors take more memory space than arrays do. It is a list of values in which each of them are identified with a number. They can be made by any element and type.

These is how you declare a vector.

 

       You declare de type inside the angle brackets.

       You can declare the size of your vector in between parenthesis ( 6).

   

             Vectors can be represented in the same way as arrays, like in a table.

       The count of vectors starts in 0.

 

Now you have located your values inside vectors, how can you access them? It is using the [ ]. You can give some space a value like this:

 

count[4]= 60;

 

The best part of using them is that its size can be modified.

 

           The copy constructor takes one vector and copies it in the same size.

 

   –       You can involve functions with a vector, like size( ). This function gives the size of a vector.

 

Vectors can also be used to create random numbers. Computers are designed to always return back any result with the same process, this is a problem when you are looking for the computer to show up a random number. C++ has a function called random that does all this process for you.

 

It is important to learn how to make use of the different facilities c++ have for you. You just need to be very careful when using them.

 

96

Normal
0

21

false
false
false

ES-TRAD
X-NONE
X-NONE

/* Style Definitions */
table.MsoNormalTable
{mso-style-name:”Tabla normal”;
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-parent:””;
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin:0cm;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:12.0pt;
font-family:Calibri;
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-fareast-language:EN-US;}

WATCH MY VIDEO https://youtu.be/XRxkoby_RUE

Here are masteries 23 and 25, about strings and vectors. Maybe…

Here are masteries 23 and 25, about strings and vectors. Maybe the most complicated for me since I just learned how to use vectors. Enjoy: https://www.youtube.com/watch?v=llPuSsueAfY

Mastery 23

#Masteries23,24,25

Creation and use of vectors in C++
Creation and use of arrays in C++
Creation and use of strings in C++

Mastery Number 23

Long video though, i accidently cut the video and had to edit it since i added more code, sorry if it seems slow.

Masteries 23 y 24: creation and use of vectors and arrays

Hey there! Here is my video for #Mastery23 and #Mastery24:

Mastery23

Vectors and stuff. Here is the usual definition of vectors, provided by our friends of Cplusplus.com: “Vectors are sequence containers representing arrays that can change in size. Just like arrays, vectors use contiguous storage locations for their elements, which means that their elements can also be accessed using offsets on regular pointers to its elements, […]

What should you work on?

Week #12 and more partial exams for you.

For this week's readings:
C++ (TC1017) should either be looking at support for your project, ImageMagick C++ libraries are a good start.
Python (TC1014) should be finishing chapter 11 (Dictionaries).