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

Warning: Cannot modify header information - headers already sent by (output started at /home/kenbauer/public_kenscourses/tc101fall2015/wp-content/plugins/slickr-flickr/classes/class-plugin.php:152) in /home/kenbauer/public_kenscourses/tc101fall2015/wp-includes/feed-rss2.php on line 8
‘Fundamentals of Programming’ Articles at TC101 Fall 2015 https://kenscourses.com/tc101fall2015 Introduction to Programming Python and C++ Thu, 26 Nov 2015 05:49:41 +0000 en hourly 1 https://creativecommons.org/licenses/by/4.0/ #BONUS https://kenscourses.com/tc101fall2015/2015/bonus-5/ Thu, 26 Nov 2015 05:49:41 +0000 http://jsphsalazar.wordpress.com/?p=188 ]]> Here’s my video!

]]>
https://creativecommons.org/licenses/by/4.0/
#Mastery11 https://kenscourses.com/tc101fall2015/2015/mastery11-3/ Thu, 26 Nov 2015 04:44:33 +0000 http://jsphsalazar.wordpress.com/?p=185 If you want to call a function in Python you need to write the name of the function and its argument/s you want to use.

This is an example:

--

You will define your function with the arguments and then you will evaluate it adding the value of the arguments.

]]>
https://creativecommons.org/licenses/by/4.0/
#Mastery12 https://kenscourses.com/tc101fall2015/2015/mastery12-3/ Thu, 26 Nov 2015 04:38:11 +0000 http://jsphsalazar.wordpress.com/?p=180 ]]> To create a function in Python, you need to write def followed by the name of the function, you can call your function as you want and finally between parentheses the argument of the function.

If you want a function with one argument you will write something like this:

00

If you want to use two arguments:

000

If you want to use a function with any argument

0

And that’s it, keep typing, keep coding.

]]>
https://creativecommons.org/licenses/by/4.0/
#Mastery4 https://kenscourses.com/tc101fall2015/2015/mastery4/ Thu, 26 Nov 2015 04:28:26 +0000 http://jsphsalazar.wordpress.com/?p=172 ]]> Submitting work via Github is very easy, you just need your GitHub account (obviously) and then you will create a repository where you write your code and then submit it.

sss

ssss

Give a name to your repository, add a description if you want to, select if you want it to be private or public, and initialized it a README. sssss

This is how it looks, if you want to insert code click on README link

ssssss

 

Then you could start typing or paste some code in this area

 

Finally, this is how it looks, you can copy the link and share it on your blog, twitter, Facebook, etc.

ssssssss

]]>
https://creativecommons.org/licenses/by/4.0/
#Mastery17 https://kenscourses.com/tc101fall2015/2015/mastery17-7/ Thu, 26 Nov 2015 04:06:15 +0000 http://jsphsalazar.wordpress.com/?p=169 ]]> This is very similar than the last one, but with the difference is that with elif we can evaluate more than 2 conditions

For example:

aqq

I’m using the same example but the elif is included.

 

]]>
https://creativecommons.org/licenses/by/4.0/
#Mastery16 https://kenscourses.com/tc101fall2015/2015/mastery16-2/ Thu, 26 Nov 2015 04:01:48 +0000 http://jsphsalazar.wordpress.com/?p=166 ]]> You can use else statement when you have two conditions and the first one is false so the condition continues with the else until it gets true.

Here’s an example:

aq

As you can see if z = 98, the first condition is not true, so the program will print the else statement.

 

]]>
https://creativecommons.org/licenses/by/4.0/
#Mastery22 https://kenscourses.com/tc101fall2015/2015/mastery22-2/ Thu, 26 Nov 2015 03:42:17 +0000 http://jsphsalazar.wordpress.com/?p=164 ]]> On Python, there are three different ways of make a repetitive task:

for statement:

for loops are the best option when you want to repeat an action for a fixed amount of elements.

while statement:

The best moment for use a while loop is when you want a program to run a certain condition is reached.

recursion with functions

This one is better when you want to simplify your code or when the loops gets hard to do complex tasks.

]]>
https://creativecommons.org/licenses/by/4.0/
#Mastery26 https://kenscourses.com/tc101fall2015/2015/mastery26-4/ Thu, 26 Nov 2015 03:26:25 +0000 http://jsphsalazar.wordpress.com/?p=155 ]]> A string is a sequence of characters. You can access the characters one at a time with the bracket operator.

I’m going to declare a variable called team and I will use it for some examples.

Len

The function Len allows you to return the number of characters inside the string. The count starts with number 0

zzz

Traversal

This one is very helpful if you want to deal one string character at a time.

zzzz zzzzz

Slices

Slices are segment of strings.You could pick up a part of the string with this one.

zzzzzz

Immutability

This means that you couldn’t replace an existing variable string at least you create a new one.

Counting

Basically this one allows you to count how many characters appears in a string.

zzzzzzzz

]]>
https://creativecommons.org/licenses/by/4.0/
#Mastery28 https://kenscourses.com/tc101fall2015/2015/mastery28-6/ Thu, 26 Nov 2015 02:54:11 +0000 http://jsphsalazar.wordpress.com/?p=152 ]]> Python has the ability to receive input coming from the user.

I’m talking about input function. When this function is called, the program stops and waits for the user to type something and the program continues when the user press return or enter.

After the input() function, Python received the text from the user and then assign the value to an variable text, after that, if the user prints the variable text, the user could see the text that wrote before.

Here’s an example:

1111

That’s basically the way it is.

 

]]>
https://creativecommons.org/licenses/by/4.0/
#Mastery29 https://kenscourses.com/tc101fall2015/2015/mastery29-3/ Thu, 26 Nov 2015 02:39:59 +0000 http://jsphsalazar.wordpress.com/?p=149 ]]> You can do a lot of things with Python, one of them is validate the input of the user. Basically, you can compare the input from the user and the input you expect.

Here’s an example:

29

As you can see, at the end of the program it asks to the user if he/she want to try with another number or ends.

Nice, right?

]]>
https://creativecommons.org/licenses/by/4.0/