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
Frida Diaz’s Articles at TC101 Fall 2015
Introduction to Programming Python and C++

Author Archives: Frida Diaz

Cars

Images

Due to time shortage I decided to omit this WSQ

Estimating e

Babylonian Method

Dictionaries

       Dictionaries are similar to list. They can store many values that can be used when called. The difference between a dictionary and a list is that every value stored in a dictionary as mapped to another value.     &n…

Tuples


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


Colors = (‘red’, ‘blue’, ’yellow’ )

Numbers = ( 1, 2, 3 )

List = ( 4, (5, 6))

Other = ( ‘red’, 2, (5, 6) )


      As you can see, tuples are pretty much like a list; what differentiates them is that tuples cannot be mutable. For creating a tuple you need to establish the name of the tuple 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 parenthesis () and separated by commas. If the element being established is a string, it needs to be between quotation marks.


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


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


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


     Also, you can add one tuple to another and create a new tuple. For that, you need to type the name of the tuple you are creating followed by an equal sign, followed by the name of the first tuple and the addition sign followed by the second tuple you will adding.

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.

The Zen of Python


       The Zen of Python is a document wrote by Tim Peters in August of 2004. This document stablishes 19 software principles that influenced the design of the Python Programming Language.


      This principles are shown whenever you type the command “import this” on a Python interpreter.


Bonus Quiz

Greatest Common Divisor

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).