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
‘#WSQ07’ Articles at TC101 Fall 2015 https://kenscourses.com/tc101fall2015 Introduction to Programming Python and C++ Thu, 12 Nov 2015 15:43:34 +0000 en hourly 1 https://creativecommons.org/licenses/by/4.0/ WSQ07 https://kenscourses.com/tc101fall2015/2015/wsq07-31/ Thu, 12 Nov 2015 15:43:34 +0000 http://estebanpg.wordpress.com/?p=31 https://github.com/estebanpinal/WSQ/blob/master/WSQ07

]]>
https://creativecommons.org/licenses/by/4.0/
WSQ07 https://kenscourses.com/tc101fall2015/2015/wsq07-30/ Fri, 30 Oct 2015 18:52:51 +0000 http://ilkapython.wordpress.com/?p=97 WSQ07 WSQ07 result

]]>
https://creativecommons.org/licenses/by/4.0/
WSQ07 https://kenscourses.com/tc101fall2015/2015/wsq07-29/ Fri, 30 Oct 2015 14:14:12 +0000 http://alansprogramming.wordpress.com/?p=111 ]]> Ranges, bounds, formulas!

Ranges

From here to there, you get it. “On The Inside, Lookin’ Out” by Bart. Link: https://www.flickr.com/photos/cayusa/2719066172

Mathematically, there’s a really cool operation we could use to get the integer sum of [n_1, n_2], so when I read that that wasn’t what we had to do (at least not exactly) it felt more interesting.

Here’s the GitHub code link:

WSQ 7.

]]>
https://creativecommons.org/licenses/by/4.0/
WSQ07 – Sum of Numbers https://kenscourses.com/tc101fall2015/2015/wsq07-sum-of-numbers-14/ Thu, 08 Oct 2015 23:07:23 +0000 http://finntec.wordpress.com/?p=41 ]]> For calculating the sum I used a while-loop. This one is nested in an if-else statement, so that the program can tell the user when we confused the lower with the upper bound.

This is my code:

print("I will calculate the sum of numbers in a range you select.")

numLow = numLow1 = int(input("What is the lower bound? "))
numUp = int(input("What is the upper bound? "))

x = int(numLow)

if numLow <= numUp :
    while numLow != numUp :
        numLow = numLow + 1
        x = x + numLow
    print("The sum of numbers in the range between", numLow1,"and",numUp,"is",x)
else:
    print("You didn't type in the numbers in the right order.")
        
print(numCom,"was the right number!")
print("You needed",attempt,"attempts.")

]]>
https://creativecommons.org/licenses/by/4.0/
#WSQ07 https://kenscourses.com/tc101fall2015/2015/wsq07-22/ Tue, 29 Sep 2015 18:06:02 +0000 http://luisgarciadaniel01.wordpress.com/?p=59 Continue reading #WSQ07 ]]> In this WSQ we were suppose to write a code to make a sum of the integer numbers in a given range, this using functions. The hard thing about this was that we had to put together all the topics we had covered before like functions, basic operations, use of else and if and even while. I based my code on a previous written code only using the accommodation of my own. Here’s also a link to my code on GitHub: https://github.com/A01154027/TC101/blob/master/WSQ07

Screen Shot 2015-09-29 at 07.35.07 cheers.

]]>
https://creativecommons.org/licenses/by/4.0/
#WSQ07 https://kenscourses.com/tc101fall2015/2015/wsq07-28/ Tue, 29 Sep 2015 18:06:02 +0000 https://luisgarciadaniel01.wordpress.com/?p=59 Continue reading #WSQ07 ]]> In this WSQ we were suppose to write a code to make a sum of the integer numbers in a given range, this using functions. The hard thing about this was that we had to put together all the topics we had covered before like functions, basic operations, use of else and if and even while. I based my code on a previous written code only using the accommodation of my own. Here’s also a link to my code on GitHub: https://github.com/A01154027/TC101/blob/master/WSQ07

Screen Shot 2015-09-29 at 07.35.07 cheers.

]]>
https://creativecommons.org/licenses/by/4.0/
WSQ 07 Sum of numbers https://kenscourses.com/tc101fall2015/2015/wsq-07-sum-of-numbers/ Sat, 19 Sep 2015 01:49:35 +0000 http://reneorozcotc1017.wordpress.com/?p=67 Continue Reading →]]> In this case I need to make a program where the user gives two numbers and the computer gives the sum between the range of that numbers.

In this occasion Ken was very helpful because he write in the blackboard how to do it

Here is the link to my GitHub
https://github.com/ReneOro97/-WSQ/blob/master/%23WSQ07

]]>
https://creativecommons.org/licenses/by/4.0/
WSQ 07 Sum of numbers https://kenscourses.com/tc101fall2015/2015/wsq-07-sum-of-numbers-2/ Sat, 19 Sep 2015 01:49:35 +0000 https://reneorozcotc1017.wordpress.com/?p=67 Continue Reading →]]> In this case I need to make a program where the user gives two numbers and the computer gives the sum between the range of that numbers.

In this occasion Ken was very helpful because he write in the blackboard how to do it

Here is the link to my GitHub
https://github.com/ReneOro97/-WSQ/blob/master/%23WSQ07

]]>
https://creativecommons.org/licenses/by/4.0/
Sum of numbers https://kenscourses.com/tc101fall2015/2015/sum-of-numbers-6/ Fri, 18 Sep 2015 19:50:19 +0000 http://saldabal.wordpress.com/?p=48 Continue Reading →]]> This task was about making a programm that asks the user for two integers. The user will read that the first number she/he types will be the begining of a serie of numbers and the second will be the end of the serie. Then the program will take all the numbers inclued in that serie, and add them all, so it will be an inclusive sum of numbers.

The task is meant for us to learn to use loops, and i selected to use the For Loop. This is so far one of the hardest parts of programing i’ve learned and according to what i´ve read is one of the most powerful.

A for loop consts of various parts, i understand it like this:

for (variable we´ll use for repeating the process) in (under what conditions it will repeat):

what to do once we’re inside the loop

The code i wrote is:

print(“Hey! This programm will ask you for two integers, the beginning”)            
print(“and the end of a serie of numbers”)
print(“So the program will display the addition of all the nubers”)
print(“within the range of the ones you provide us”)
print()
x = int(input(‘Please type the first number of your serie: ‘))                  
print()
y = int(input(‘Please type the second number of the serie: ‘))                  
c = 0
print()
for i in range(x, (y+1)):                                                       
    c = c + i

print(‘The sum of ‘,x, ‘ to ‘, y, ‘ (inclusive) is: ‘, c)

I was thinking of ther solutions but once i figured how to do it with for, i realize it only takes me two lines.

So, the explaining of my code is that first i asked the numbers to the user. Then i had to set the first number that i had to add, i choose 0 because it wont affect my operation. Then wrote the for loop. I started with ‘for’ and the i followed with the variable that will repeat the process of the loop, i selected the letter ‘i’. Then i type ‘in range (x,(y+1))’ which means that the loop must repeat in the range of the numbers the user gave me. If you are wondering why i set ‘y+1’ thats because the function range is composed to start where it is told (or zero if it doesn´t say where to start) and to end where it is told minus one. So to fix this i simple add it one.

The the body of the loop is that c = c+i. Lets remember that C starts being zero, so the first will be ‘0 + i’ where ‘i’ will start being the first number the user gave me. So after that the loop will start all over again, now ‘i’ will be ‘i+1’ because of the body and ‘c’ again will be the previous c we saved on memory plus the actual value of i. This will be performed until ‘i’ reaches the second value the user gave us. Then the sum of all number, inclusive, will be done and ready to be printed.

]]>
https://creativecommons.org/licenses/by/4.0/
WSQ07 https://kenscourses.com/tc101fall2015/2015/wsq07-18/ Fri, 18 Sep 2015 19:34:22 +0000 http://5nbppkkyj.wordpress.com/?p=96 This was challenging but surprisingly fun. I had some problems that were solved understanding what I was doing so the book helped me a lot.

This is my code:

Screen Shot 2015-09-18 at 2.20.32 PM

This is Sumofnumbers.py in action:

Screen Shot 2015-09-18 at 2.22.31 PM

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