June+17th+2016+by+Michael+Qian

What's up everybody!

welcome to today's log file of 2016 IB hacker group!
before you get started on your homework, let your dearest friend Michael to help u do a little recap first! Anyway, let's cut the crap and get started!

=1: chr and ord method=

After today's lecture you should have an intuitive sense of the function of chr and ord When we type in numbers, English characters or even weird notations like (sigma) in python, the computer wouldn't recognize the things we type in. Stupid huh? However, to make the computer understand it better, it undergoes a conversion of the things you typed in and ACSII code, basically every button on the normal QWERTY computer keyboard has its corresponding ACSII value. Here is the illustration: __note the differences:__

code >>> ord("a") 97 >>>ord("A") 65 >>>chr(97) a code =2: writing our own function!=

After all these work, we finally get to write our own functions, which made our work much easier! Nevertheless, there are some points worth noting about it.

2.1:parameters
parameter most functions requires parameters which is located in the parentheses after the functions you defined. make clear extinction between these two fellow: formal parameter:variables which will later be given values actual parameter:the actual parameter or number which get substitute into the function

2.2:parameter has its life
bear in mind that parameter has its life! depending on where it is declared. parameters in the functions you defined will only live in the functions which you defined! As soon as it gets out of the function the parameter die with it. So here comes the problem. What should we do if we still want to utilize the parameter's value? the answer is using **__return:__** __here's a simple illustration:__ code def a(a): if a < 0: return(-a) else: return(a) a = int(input("give me a number")) print(a(a)) code if we don't use return the program will have no memory of the parameter and when you tries to use it afterwards, that's generally bad times....

2.3:coding convention
here is a special point you should consider regards to coding convention. In other words make your functions more self-explanatory. """ helps you to do that. You can put in notes between """ (notes)""" in the definition of the function. And a special method called help enables you to check your notes: code import math def max_simple(x,y,z):   """This is quite simple"""    if x(z)>y(z):        return x(z)    else:        return y(z) help(max_simple) print(max_simple(math.sin, math.cos, 1)) code and the result code Help on function max_simple in module __main__:

max_simple(x, y, z)   This is quite simple

0.8414709848078965 code We already know that # is a way of explaining the code for our reader and programmer, but it isn't as unique as the """ since it doesn't show its content when we use help, and it can only mark one single line as notes.

Thats it for Today's log, bye!!

your friendly neighborhood Muscle

Homework： No mandatory homework. =Hooooooray!!!!=