Day 4

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

Screen Shot 2016-06-23 at 11.40.54 PM

Screen Shot 2016-06-23 at 11.40.58 PM

  1. Describe briefly what you’ve learnt.

For today, I didn’t have enough time to finish 2 lessons on Python. I will catch up more on Javascript tomorrow.

For Python, I learned how to incorporate lists and functions together. And also iterating over a list in a function.

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

def total (numbers):
result = 0
for digit in numbers:
result = result + digit
return result


if guess_row == ship_row and guess_col == ship_col:
print “Congratulations! You sunk my battleship!”
if (guess_row < 0 or guess_row > 4) or (guess_col < 0 or guess_col > 4):
print “Oops, that’s not even in the ocean.”
elif(board[guess_row][guess_col] == “X”):
print “You guessed that one already.”
print “You missed my battleship!”
board[guess_row][guess_col] = “X”
if turn == 3:
print “Game Over”

  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 a YouTube video to help me. https://www.youtube.com/watch?v=7Ki_2gr0rsE

Leave a Reply