I2P-Bernard-Day5

Day 5

  1. Screenshots describing what you’ve completed on Codeacademy.

Screen Shot 2016-06-25 at 12.06.44 AM

Screen Shot 2016-06-25 at 12.06.48 AM

 

Screen Shot 2016-06-25 at 12.09.01 AM

 

  1. Describe briefly what you’ve learnt.

For Python, I learned about for and while loops. I also had a chance to practice and apply them.

For JavaScript, I learned about arrays and objects (just an introduction). I also learned how to use a handy tool called the switch.

  1. A few lines of code with comments showing your understanding of the code.

Python:

def print_grades(grades):
for grade in grades:
print grade

def grades_sum(grades):
total = 0
for grade in grades:
total += grade
return total

def grades_average(grades):
sum_of_grades = grades_sum(grades)
average = sum_of_grades / float(len(grades))
return average

def grades_variance(scores):
average = grades_average(scores)
variance = 0
for score in scores:
variance = variance + (average – score) ** 2
variance = variance / len(scores)

JavaScript:

switch(color) {
case ‘red’:
console.log(“Red’s a good color!”);
break;
case ‘blue’:
console.log(“That’s my favorite color, too!”);
break;
case “yellow”:
console.log(“That’s my favorite yellow color, too!”);
break
default:
console.log(“I don’t think that’s a primary color!”);

  1. Other resources you came across in this learning process (e.g. a post from a discussion forum, an advice from your friends/classmates).

I used the YouTube videos provided in the Schoology page made by Mr. Lin.

Leave a Reply