It did what? 20 secrets about this course review.

--Originally published at Carolina's Blog Site

Hello everyone!

So I am done with my first semester at el Tec, now it’s just finals! WOW, I can’t believe it went by so quickly!!!

Anyway, one of my favorite classes this semester was fundamentals of programming TC101 with To Ken Bauer, so here’s a short review of the course:

I remember our first day, when Ken made us stand on our desks and yell ‘it’s okay to fail’ and told us all about his abolish grading policy and his flipped learning classroom style. It was all sooo new to me!!! I think this learning concept is very different from other teachers’ methods. Consequently, it has its pro’s and con’s.

Everyone learns at a different pace, however, most classes make learning homogenous and don’t encourage individuality, so people feel like they’re always ahead or always behind. This style lets you progress at your very own pace and way. It offers flexibility, and it encourages learning for the sake of learning, not for the sake of earning a grade or accomplishing a homework. Another thing I loved is that it discourages grading, which is like the ultimate individuality destroyer, because every person is different, so you cannot compare them, especially not with such a simplistic method. It makes me so mad that schools do this. It’s simple really, you just can’t compare apples and oranges. Period.

However, there’s also disadvantages to this kind of learning. Even though the freedom it gives you to learn/study can help you grow and discover what works for you, it can also let you not work at all. If you have enough discipline, you can make yourself learn, ask for help and learn from others. Ken is always willing to help and so are your classmates. However, if you don’t, you can end up leaving

Continue reading "It did what? 20 secrets about this course review."

Validating user input

--Originally published at Carolina's Blog Site

So when you ask the user for input, you need it to give you a valid input, something you can do whatever it is you wanted to do with it. For example, let’s say you ask for the user’s age because you wanna add something to it. Well, the user might write bdjsfkfs, you never know! So you must prepare accordingly.

First of all, be sure to specify when asking the user for input. Do not assume they know what you want from them. Have the program say things like “only integers, or rounded to the nearest whole number or in military time please.”

pink sweet minions despicable me agnes
source

Now, when asking for input, it will always be given as a string, and you won’t be able to do math operations with it.

capture

One thing you must do is transform the user input into a number by using the int function. That way Python will automatically turn it into an integer and will be able to do math operations with it. Example:

age = int(input("Please enter your age: "))

Another great thing you can use in Python is the try/except statement, like this:

def valid_user_input(x):
    try:          #what you want it to do
        return int(x) > 2
    except ValueError:     #if an error happens,
        print ("please type an integer")     #do this
        return None

 


Why global variables are evil

--Originally published at Carolina's Blog Site

So, I’ve heard that programmers should always avoid global variables, and I never really understood why. I think this article explains it really well:

4.2a — Why global variables are evil

Hardcore Programmers
source

Max of 3 values

--Originally published at Carolina's Blog Site

Challenge: create a program that takes three numbers as arguments and returns the largest of them.

At first I got all confused and started making unnecessary loops. It was very frustrating.

confused joey joey tribbiani matt leblanc im so confused

Then Ken reminded me that when creating a program, first you must think about it logically, forget about the sintax: what does your program need to do? how would a human do that? how would you explain it in pen and paper?

That made things a lot easier. IMPORTANT ADVICE TO REMEMBER.

Image result for sudden realization meme

So then, basically what I did was assume that the first integer given by the user was the biggest one, created a variable for it, and then I compared it with the other values and changed it if necessary.

Here’s my code, hope it’s helpful: https://github.com/cpvp20/max_of_three

 

sources:

http://giphy.com/gifs/money-help-wwyb-vsZF2hC9cH0Mo

http://knowyourmeme.com/memes/sudden-clarity-clarence


New challenges coming up…

--Originally published at Carolina's Blog Site

So Ken posted this great link that has all kinds of challenges, and you should really check it out!! http://www.ling.gu.se/~lager/python_exercises.html

I’m gonna try to do all of them.

challenge

This is the one about the len function, a function that computes the length of a given list or string. I know that Python has the len() function built in, but it’s a good exercise. Here’s my code: https://github.com/cpvp20/len-function

sources:http://giphy.com/gifs/challenge-I7wD1UNqmcv6g


Madam, I’m Adam. and other palindromes.

--Originally published at Carolina's Blog Site

Hey so… palindromes,

 Wat -  Wat  old lady wat

So I didn’t know this before last week, but a palindrome is a word or phrase that reads the same backward or forward, such as kayak or racecar.

Anyways, Angel and I made a program during Ken’s class that takes user input, splits it into words, and feeds back which ones are palindromes and which ones are not, and it works YAY!

dancing the fresh prince of bel air happy dance fresh prince of bel air carlton

Since there’s no built in  reverse function in Python strings, we created a function that reverses a string by slicing it… more about this at http://stackoverflow.com/questions/931092/reverse-a-string-in-python.

So yeah, check out our code at https://github.com/cpvp20/palindrome/blob/master/palindrome.py

sources:

http://www.quickmeme.com/meme/3u0jqj

TACOCAT

http://giphy.com/gifs/dancing-fresh-prince-of-bel-air-carlton-pa37AAGzKXoek