I2P-Simon Kye-Final Project Code Rundown

I honestly think I do a better job talking about the code in the report than the video if the video didn’t make sense.

I would just recommend using the form itself and looking at what happens to the google spreadsheet but here is the code if you want to implement it yourself. Remember to change the if statement to the numerical version of the date just as mentioned in the video. Make sure the questions in the form are formatted in the exact same way so that it ends up on the same columns. Make sure to change the value with the maximumBid to =MAX(H2:H) in the google spreadsheet itself. I also changed the code so that although it says July 1st in the auction, I increased the deadline so that you can test out all the features instead of just a email saying “The auction is closed”

Here is the spreadsheet, form and a video of the code working and the actual code itself.



function sendEmail() {
  for(var a=0; a<2; a++){
  var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  var lr = ss.getLastRow();
  var column = ss.getRange("A2:B");
  for (var i=2 ; i<=lr; i++){
    var currentEmail = ss.getRange(i,3).getValue();
    var currentName = ss.getRange(i,2).getValue();
    var currentBid = ss.getRange(i,4).getValue();
    var emailSent = ss.getRange(i,7).getValue();
    var currentDate = ss.getRange(i,1).getValue();
    var currency = ss.getRange(i,5).getValue();
    var hkdBid = ss.getRange(i,8);
    if (hkdBid.isBlank()){
    var emailBid = ss.getRange(i,8).getValue();
    var maximumBid = ss.getRange(2,6).getValue();
    if (currentDate<=43282){
      if (emailBid==maximumBid){
        if (emailSent != 2){
          MailApp.sendEmail(currentEmail, currentName+" your bid has been accepted!", "Dear "+currentName+","+"\n\n"+"Thank you for participating in the wonton google form auction!"+"\n"+"Your bid of "+currency+"$"+currentBid+" has been accepted!"+"\n"+"If you know anyone else that is interested in participating in the auction, please let them know!"+"\n\n"+"By Simon")
      if (emailBid<maximumBid){
        if (emailSent==2){
          MailApp.sendEmail(currentEmail, currentName+" someone else has taken the max bid!", "Dear "+currentName+","+"\n\n"+"You have previously participated in our wonton google form auction, and someone has overtaken your bid of "+currency+"$"+currentBid+"! The new maximum bid is now HKD$"+maximumBid+"\n"+"Come back and bid higher to claim your tasty wontons!"+"\n\n"+"By Simon")
       if (emailSent!=2){
         if (emailSent!=1){
           MailApp.sendEmail(currentEmail, currentName+" your bid has been rejected!", "Dear "+currentName+","+"\n\n"+"Thank you for participating in the wonton google form auction."+"\n"+"Your bid of $"+currency+"$"+currentBid+" has been rejected!"+"\n"+"The current maximum bid is HKD$"+maximumBid+". If you want those tasty wontons, bid higher than the maximum bid!"+"\n\n"+"By Simon")
    if (currentDate>43282){
      MailApp.sendEmail(currentEmail,"Sorry the auction is now closed.", "Dear "+currentName+","+"\n\n"+"Thank you for your interest in participating in the google form auction, but we are past July 1st, 2018, and the auction is now closed. Sorry!"+"\n\n"+"By Simon")

function sendResults(){
  var ss = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet();
  var lr = ss.getLastRow();
  var maximumBid = ss.getRange(2,6).getValue();
  for (var i=2 ; i<=lr; i++){
    var currentEmail = ss.getRange(i,3).getValue();
    var currentName = ss.getRange(i,2).getValue();
    var currentBid = ss.getRange(i,4).getValue();
    var currency = ss.getRange(i,5).getValue();
    var hkdBid = ss.getRange(i,8).getValue();
    if (hkdBid==maximumBid){
      MailApp.sendEmail(currentEmail, currentName+" you won!", "Dear "+currentName+","+"\n\n"+"Thank you for participating in the google form auction. The auction has now ended and you have won your prize with your bid of "+currency+"$"+currentBid+"!"+"\n"+"Come pick it up at Hong Kong International School at the start of school. Thank you!"+"\n\n"+"By Simon")

I2P-Simon Kye-Final Project Progress Report

Day 1

Following the design thinking process, my first step to take was empathising. To simply put it, the goal  of empathising here is to learn about the audience and the context of the situation or problem. The problem here is I want to make a automated bidding system using google forms. The audience are bidders who wish for simple, online, and easy-to-use bidding system. Usually to empathise, it is best to interview the actual audience or experience it yourself to gain a deeper understanding. Unfortunately, I do not bid, or know anyone who bids on things, so I am unable to completely finish this step, but I can do the next best thing, ask anyone about the problem. As getting opinions other than yourself is important to making a good product. I asked three of my friends (Sean, Daniel, Jennifer) and my parents what I should do. Here are the things I got:

Few questions, a good explanation on each item on why the bidder should bid on this item, quick, simple, should give option to email the person to notify the person if anything happens (If item is about to be sold, if bid goes higher).

Personally, I agree with all of these points and I’m glad I asked other people for their opinion as they gave me ideas I previously didn’t have.

Now, I have to define the problem. I need to create a more detailed plan than just ‘making a bidding system on google form’. I need to sharpen the question. After I defined the question, the question looked more like ‘making a google form that would be to make a automated bidding system on google form that is easy and simple to use for the user by showing who currently has the highest bids and the amount that they bid on.’ But this is the minimum of my final product. Right now, although this is a good goal to strive for, this isn’t the goal I’m reaching for right now. As said in the video, it is important to take small steps when trying to accomplish your goal and I need to define my goals a bit more realistic with my current knowledge. Keeping this in mind, I came up with the goal to ‘Create a google spreadsheet that can determine what the highest number from a list of numbers and display that onto the form’. I also made a flowchart to help me with planning. This is currently the flowchart for the most simple version of my final product.

For the third step, I need to begin ideating, on how to make a auction with google scripts, but before I can do that, I need to do more research on how a auction would work in javascript and how I can implement it in google forms.






These websites gave examples on what a google script code should look like and all the commands that were available (which was overwhelming at first to process all of them)

Something I realised while working on this is that google scripts isn’t too beginner friendly and most explanations in forums already assume you know most things. I looked through for commands that I needed to help me with this project and found some that were useful, but even when it came to that, it was very confusing how I would implement it into the code. I’m met with videos that are around 20 minutes to 1 hour long videos that are just slightly related to my topic. Something I also learned while doing this is that I need to learn HTML as seen from the custom google forms I could find such as this video: https://www.youtube.com/watch?v=38H7WpsTD0M The biggest challenge I came across were the lack of effective resources that were available especially when it came to making forms, something I also found hard was finding a command that took from a spreadsheet, got the value, and somehow transfer that variable over to the form side of things. Currently the closest function I could find was which was from the same video listed above, and I have little to no clue what it means

var values = SpreadsheetApp.getActive().getSheetByName('Name')

It seems as if for every question I try to answer, more pop up, and although don’t fully understand how this works, I know if I keep trying I will find a solution. This could also be just a lack of researching abilities on my part for finding obscure things.

Basically, today I realised the difficulty of the task I’ve given myself. Although I haven’t learned much in terms of google scripts that is useful to me, I’ve learned little bits and pieces that I hope will help me in the future. Failure is a part of learning to tackle problems, and I will persevere and try my best to keep insightful reports about my experience with this project and create a good final product. It is also important to keep in mind the accomplishments I’ve made with properly empathising and defining the problem. My plan for tomorrow is research more and have a working draft of the project.

Day 2

After more researching, I was still unable to find a way to get google forms to show results of the poll within the form itself, so I went back to defining and thought of a new plan with the resources I was given. Instead of showing something on the form, depending on what the person submits in the form, it will send out a email to that person on if their bid was accepted or not and what the actual maximum bid is. I used the resource given from Ms. Mok, to come up with this code. This video helped me with the basics as it was very beginner friendly and I came up with this code. I’ve made much more progress and have created my first draft. You will have to click on it and zoom in quite a bit. This is basically as simple as the code gets. What this basically does is that it checks the spreadsheet for values, each command explained in the photo below and sends a different email depending on how high the bid was compared to the maximum bid. I tested and was successful.

Now that I was done with my first draft, I was back to ideating. What am I missing here? It was pretty easy to think of as it is currently very bare bones. I redefined my problem as the emails that were sent out always sent out a new email. Even to bidders who have already received their first email. This is very annoying so I found this on the forums https://productforums.google.com/forum/#!topic/docs/3Quykp2Gzjk and used it to make sure no more duplicate emails were sent out. Something that also should happen is that it should notify the user if someone else bids higher than them and is overtaken. So I began writing more and came up with the solution on my own. The previous comments have been deleted and will be deleted everytime I make change to avoid clutter. After testing, it was successful and I moved onto my next step

Now that I was done with that, I needed to ideate once again. The new issue I wanted to tackle was to make the form more realistic and reject any bids made after the end of the auction. This problem probably took the longest besides from starting the project itself. I tried using date.parse, or slicing the string of the date so that it would appear as 20180617 YYYYMMDD and then I would do the if function with the end date. But none of these functions were available in google scripts for some reason and I had to get creative. I looked for more videos and came with this. https://www.youtube.com/watch?v=ZcNmur6xiX4 There is a way to make dates into numerical numbers by formatting and I began google searching how to put that into google scripts. The result was not easy to find but I met this website found in a forum. http://www.blackcj.com/blog/2015/05/18/cell-number-formatting-with-google-apps-script/ This helped me implement the date system into my project so that I could I also made sure that noone could send in anything other than numbers in the google form when bidding so that it doesn’t give bugs. All of this came out successful after testing although I had to test the most amount of times with this part of the challenge.

Back to ideating again! Quite late into this project I realised I had a problem. The function did not run automatically when a new data was submitted. It was instead had to be run manually by me in the script editor. So I look to fix that. The solution to this was quite simple. After google searching, I found this and luckily had to write no extra code for this. https://productforums.google.com/forum/#!topic/docs/_skuJIuf-eU I tested once again and it worked as expected.

There was one more thing I wanted to do before finishing it off. To notify the winner of the bidder when the auction ends. I found the solution to this in google’s official function listings of a clock trigger builder and made this (1st image). https://developers.google.com/apps-script/reference/script/clock-trigger-builder. But for this it needs to have a whole new function for when  the auction ends. This was basically just a bunch of copy and pasting with taking multiple variables, functions, and if statements out as they were unnecessary (2nd image). I tested this function and it works! I also made sure that people could only submit emails in the what is your email box to avoid bugs.

This was the final code I was left with at the end of day 2.


Today I managed to accomplish so many things. All I needed was a place for me to start. It was just so hard to get started when you had no clue what anything meant and what to search on google. My searches initially looked like “How to insert google spreadhseet cells into google forms google scripts” but by the end I knew exactly where I was going. Thanks to the video sent by Ms. Mok, which was very beginner friendly, I had a direction to go and I was able to make much more progress than I expected of myself and I’m very proud of myself for sticking through and finishing this. I had to learn so many new functions that were specific to google scripts and javascripts functions that we learned in the past didn’t work sometimes and I had to find a way around that. I got better at researching and learned much more google scripts functions.

Day 3

It is the third day and back to ideating! I have so far completed the core mechanics of a auction but there were just a few pieces missing that I could add to make this project even better. I first polished up my code to send more professional looking emails. I also added the location of where to receive the prize. I’ll just copy and paste the new code here as it is very long to take a photo of.

“Dear “+currentName+”,”+”\n\n”+”Thank you for participating in the wonton google form auction!”+”\n”+”Your bid of $”+maximumBid+” has been accepted!”+”\n”+”If you know anyone else that is interested in participating in the auction, please let them know!”+”\n\n”+”By Simon”)

“Dear “+currentName+”,”+”\n\n”+”You have previously participated in our wonton google form auction, and someone has overtaken your bid of $”+currentBid+”! The new maximum bid is now $”+maximumBid+”\n”+”Come back and bid higher to claim your tasty wontons!”+”\n\n”+”By Simon”

“Dear “+currentName+”,”+”\n\n”+”Thank you for participating in the wonton google form auction.”+”\n”+”Your bid of $”+currentBid+” has been rejected!”+”\n”+”The current maximum bid is $”+maximumBid+”. If you want those tasty wontons, bid higher than the maximum bid!”+”\n\n”+”By Simon”)

“Dear “+currentName+”,”+”\n\n”+”Thank you for your interest in participating in the google form auction, but we are past July 1st, 2018, and the auction is now closed. Sorry!”+”\n\n”+”By Simon”)

“Dear “+currentName+”,”+”\n\n”+”Thank you for participating in the google form auction. The auction has now ended and you have won your prize with your bid of $”+currentBid+”!”+”\n”+”Come pick it up at Hong Kong International School at the start of school. Thank you!”+”\n\n”+”By Simon”)

After this, I began brainstorming again. This was just a simple auctioning system. For people to want to use it, it should be something a bit extra to make it stand out, as the end goal should technically be to make as many people as possible. For this to happen, we should also be as inclusive as possible by not limiting it to Hong Kong. So I tried implementing currency conversion and this is what I got. Once again I did it all on my own. A unmentioned change that isn’t in the comments are that the maximumBid is now taking the maximum of the 7th column. It also turned out that the script for creating triggers didn’t work and there was a option to set up a trigger on the day the auction ends. Here is the new code with the comments

After the three days of work on my final project, here is the result



As you could see I couldn’t implement as much as I did on the other day as I had little time available, that is why a big proportion of the project is based around the second day as I dedicated a entire day to it.

I absolutely loved this challenge and it challenged me way more than the python challenge would’ve and I’m so glad I didn’t change my final project. This gave me a sense of accomplishment and everytime I figured out something that seemed impossible, it felt amazing. The hardest part about this challenge was getting started. I didn’t know what anything meant and diving in blind to a new coding language was very overwhelming at first. But I overcame these challenges and constantly used the design thinking process to help me along the way. In the end, I was able to make a bidding system that was able to accomplish all of the things listed above and was like a real basic bidding system and even managed to add in a currency converter. I originally thought my final product would be very flawed and miss many features but I managed to include all the core features a auction would have. Although it wasn’t like my original plan of showing the highest bid in the google form, I came up with a way around it to make the auction still work.

EDIT: There is a bit of inconsistency. For some reason it doesn’t send the email all the time. If it doesn’t work try again but with a different bid number.

I2P(F)-Simon Kye-Mini Project Week 2

Today I was unable to complete the mini project, but I am very satisfied and happy with the progress I was able to make with my product as I know I’ve pushed myself to try new things that I’ve learnt in class, but never really used in any of my daily challenges. Below (1st image) is the code that I ended up with. I’ve hit a wall that I’m unable to get over for now. This is what I planned would happen. The game would start of with introducing the player. The player would then choose a word to be guessed and this would be stored in the variable word. Right now the gameLetter() doesn’t mean too much. If we skip that and go to the for function on the bottom, it makes it so that for each letter within word, it puts it into the characterList, and each time that happens, it also adds a _ for blanks list. This is why the amount of _ corresponds to the amount of letters in the word. The while function is made so that if the score (correct answers) is less than the amount of letters in the word, the game continues as it runs the gameLetter function. We can now go into the gameLetter function. It sets the gameScore to 0 and if the character that player 2 guesses is in the character, it would find the index of the letter of the guess that matched the word and replace that blank with the letter. This is how the _, _, _, _,_ turns into a h, _, _, _, _. It then prints the list blanks and it is luckily formatted in a way that I don’t have to edit the format the list is made in. This also adds to the gameScore everytime you are right, and we already made sure that the gameScore is corresponding to the amount of letters in the system. If this number increases to the length of the word, then it prints ‘You win!’ and ends the game. Ofcourse if the letter doesn’t correspond then the answer is wrong and says try again. I tried implementing lives too (2nd image) but came up red and I did not know how to fix it so I took a step back and tried it with infinite lives. For some reason, my game will only accept the first letter of the word and nothing else (3rd image). If I put in the first letter of the word the amount of times corresponding to the length of the word, it says I win. I have no idea why it does this and I can’t even look at other people’s blogs at the time of posting for help. So currently this is all I have, but I am proud of trying something new and more experimental 



I2P(S)-Simon Kye-Weekend Mini Project




For this weekend miniproject, this took me quite a while to finish. I chose the option of how to get to school. The flowchart is pretty self explanatory. The code is basically what the flow charts says with all the options added on there, but I also refined it to make it better. I made sure the code did variabe.lower() to make sure a person could write yes or Yes or no or No. I also added a else for every option saying ‘I do not understand what you are saying’. The variables I chose were purposely very short to make it simple and easy to identify. The code isn’t only comprised of if variable == ‘yes’ or ‘no’ statements, there are some that checks which station or bus number you need to take. There is also a while loop in the code. Basically what the while loop does here is during the question asking public or private transportation, because there are literally only two options and nothing else, just like how the flowchart shows, it loops if both public or private is chosen as false instead of printing something like ‘You have to choose between private or public’ and ending the code, it loops. I would’ve done this for all of my options but it would’ve been even longer and more time consuming. I hope this demonstrates my knowledge of while loops. I tested out my code several times and worked perfectly.

I2P-Simon Kye-Day 6

Codecademy Proof:

Things I learned


__init__(self) initialises or boots up the objects in a class (self is not required but most people use it)


We have to remember that global variables, member variables, and instance variables exist and same goes for functions too

A function within a class is a method

A class method to override is the __repre__()

f = open(“output.txt”, “w”) This tells the computer that the file object ‘f’ opens output.txt in w mode which is write, r+ can be used for reading and writing

file.close() before writing anything

.write() takes in strings and writes it down

+ “\n”makes sure if a for function happens, all the values appear in a new line

.readline() reads the lines subsequently with each readline command there is

You can use  __enter__() and __exit__() to open and close files the way we do this is with with ‘open() as ‘anything”


Something I realise is that it gets harder and harder to explain things in my blog posts and using examples are starting to help much more. As the lessons are becoming more how to use the functions and variables. The difficulty of these lessons are still very difficult but aren’t getting more difficult thankfully.


Daily Challenge:


This challenge was pretty simple after I knew what I had to do. The code above is the same thing as the caesar cipher, a old ciphering method used where the letters are shifted three to the right.


The challenge was a bit too much for me currently. I’ve even tried looking at other people’s posts for some clues on where I should start. But I hope to do this for my final project.

I2P(F)-Simon Kye-Day 5

Codecademy Proof:

Things I learned:


We got to deal with statistics using python. This unit was considerably easier than the last 2 units before it. I didn’t learn much besides polishing my skills

dictionaryName.items() shows collection of keys and values in no particular order

.keys() returns a list of dictionary keys

.values() returns a list of dictionary values

When slicing a list, [start:end:stride] stride is the space between start and end that adds a number

You can get opposite of the list by making the stride negative

‘lambda x: x % 3 == 0′  is the same as ‘def by_three(x): return x % 3 == 0′

We have to then pass the lambda through a filter()

Binary numbers have a base of 2. Instead of counting normally it looks like this

print 0b1, #1
print 0b10, #2
print 0b11, #3
print 0b100, #4
print 0b101, #5
print 0b110, #6
print 0b111 #7

bin(#) shows us how it would be written in binary

int() has a second parameter where you can choose what base it goes up by

binary << number  literally shifts the binary to the left by how much you want it to

binary >> number does the same thing but to the right

A & operator checks if there is the same number in the same position

A | operator chooses the bigger number in the same position

^ operator chooses only exclusive numbers in the same position

~ adds one number and makes it negative


.forEach() executes code on every element of an array

.map to change function of an array

.charAt(index) shows the character at that index in string

.filter() filters out all the variables that aren’t true to the condition

Objects in js is just like dictionaries in python

object.key is used to access values


Daily Challenge:


There is not much to say about this challenge (at least in python) It was easier than the day before and there wasn’t any real struggles working on it and helped us practice our while and if functions.

Here is the code:

Here is the game in action: I put ‘print number’ before the while statement to show the code works as intended

The code itself here is pretty self explanatory, but there is one thing here to make the code stand out a little. I added a function to make it possible for me to be able to type a number outside of 1 and 100. I made sure it came before the conditions to check if guess>number or guess<number as if that happened, it would just output that as being outside of 100 still technically counts as being bigger than number. So to prevent that I just put it above that line of code. (I realize I misspelled right as write in line 9)


Again almost the exact same code used for python but in a different format. I also had to put it inside a HTML file as javascript are just commands and for it to be presented, it needs to be in a file like HTML. We first define our number by using Math.floor which rounds up the number to make it an integer. Then use Math.random to pick a random number between 0 to 1 then multiply by a 100. I then create a variable of winstate as false. The alert(number) is just there for me to test if the code works. If I was giving this to a stranger, I wouldn’t have added that. The code works the exact same as python but this one has break on the winstate and the format is slightly different.


I2P(F)-Simon Kye-Day 4

Codecademy Proof

This lesson helped me polish my skills with list, functions, and loops. But something I wonder is how well I’ll do without any of these steps to help me as I feel as if I’d be clueless without the step by step guide codecademy provides. Something I found significantly challenging to grasp the concept of lists inside a list. I found myself getting stuck in codecademy much more often compared to other lessons and I feel as if the difficulty of the course is getting exponentially harder.

Things I learned:


list.pop(index) This will remove the item at the index selected and returns it

del(list[index]) is just like pop but won’t return the item in that index

while loop is similar to if function but goes forever if true instead of just once

An infinite loop is a loop that never exits due to something that keeps the loop condition from becoming flase

In a while/else construction, when the while condition is set to false unless stopped by a break, the else condition will always execute

A comma after print means the next print prints on the same line

When looping over a dictionary, you get the key which we can use to get the  value

enumerate supplies a index inside the list

zip will create pairs of elements when passed two list

factorial(number) finds the sum of a factorial of a number. Keep in mind factorial(1) is 0


A way we organise and store data in javascript is to use arrays which acts like a list

let arrayname = [list_1, list_2]

arrayname[index#]  Outputs that index in array

We can also change whats in a array with arrayname[index#] = ‘New string/variable’

arrayname.length tells us the length of the array

arrayname.push() allows us to add the strings at the end of an array

arrayname.pop() removes the last item in the array

arrayname.shift() removes the first item in array

arrayname.unshift(stringname) adds item in beginning of array

arrayname.slice(beginning index, ending index+1) Chooses part of an array to take out

const of an array can have values added or removed but the values itself can’t be changed

while (condition) {



This behaves the exact same as python while function

break also behaves the exact same


Daily Challenge:

The two images below shows me trying to finish this daily challenge. The third and fourth image is the result of that. (These two images are from the same run in the console) The code is made so that is starts with a empty dictionary and an event would be tied to a month in the calendar. The key would be the month and the value would be the event. That is what I based all of the code around. Adding, deleting, updating, and viewing the values of the calendar by entering the key of the calendar when asked by the computer. I used the while function by first making the variable true to make this a infinite loop so that the calendar never ends. This doesn’t end up crashing my computer as it stops to ask a prompt from the user. I’ll first explain the code for add. It displays the calendar that needs an event added and asks for the event. The event is then combined with a string and with the key of the month. Luckily I could reuse this code for update as updating a date is the exact same function as adding a event to a date. View just showed the value/string of the key and delete removed the key and the value using the command del calendarevent[month].  Something I failed to do was what if there was no event on a date when asked during view/delete/update? It was meant to reply with ‘There are no events during this month or there was an error’ And my first attempt can be seen to accomplish this but it would always fail if the question answered with a date without a event. I tried to use a function to find the key of the calendarevent[month] as it only showed the value, but I was unable to find a code on the internet. If I found one, it would’ve turned out as ‘if calenarevent[key] == month:’. But I was unable to make it show the key so I tried coming up with what we see on the screen and failed.

I2P(F)-Simon Kye-Day 3


Things I learned:


Functions are defined with three compounds:

The header which includes (def word():), An optional comment “””comment””” and body which tells what the function to do such as print “random”

def hello_world():

“””Prints ‘Hello World!’ to the console.”””

print “Hello World!”

After defining, using (function()) at the end of code tells the computer to look for the function

Placeholder variables can be used in defining a function called parameters.

i.e def power(base, exponent)


This tells the computer to replace the base and exponent to those numbers when carrying out the function written above

We can import things(module) into python that contains variables and functions into python

module.module_command() Tells the computer to go into the module and find a function/variable from there.

If you want to import just one function, you type (from module import function). This removes the need to type the module part of module.function()
If you still don’t want to type the module part of module.function but want to use all the functions, type (from module import *). There is a problem with this though. Some modules have same function names that do different things which make it very confusing

max(): Takes numbers from a argument and returns largest one.

min(): Does opposite of max()

abs(): Returns absolute value

type(): Returns the type of data it received in the argument

I got to polish my skills with using functions with the adding prices activity in codecademy

Lists are a way to store multiple pieces of information under a single variable

list_name = [whatever, random]

Lists also have a index (The stuff labeled from 0 to n depending on how many things are on a list) and we can use this take out certain variable

list.append(‘string’) adds on the string to the existing list at the end of the list

To access a portion of a list, we list [(index you want to start), (index you want it to stop at, it will also exclude this index)]

list.insert(index you want to insert it in, “string you want to add”)

list.index(string) tells which index the string is in

The ‘for’ function changes a value for every string in a list

list.sort() sorts everything in alphabetical and in numerical order

Keys are like a index and can be assigned to each string to help find a string inside a list

Dictionaries can also be changed or add values inside them:

To create a new dictionary: dict_name = {all the keys you want in there. Use colon to assign a variable something}

To add a new key to a dictionary: (dict_name[new_key] = new_value)

To remove a key from a dictionary: del dict_name[key_name]

To replace a key from a dictionary: dict_name[old_key] = ‘New Key’

list.remove(“string”) to remove things from a list

We can use ‘if’ function right after the ‘for’ to choose what the function does that fits the condition.

Example from codeacademy:

numbers = [1, 3, 4, 7]

for number in numbers:

if number > 6: print number

print “We printed 7.”

Strings can be looped through just like a list


Functions are block of code created to perform a task

() => Indicates the variable stores a function

function_name(); This runs the function

Parameters are variables in a function that accepts a input that can be used in the function. The parameter is inserted in the () part of the ()=>, we can also set as many parameters as we like.

return helps get the result of a input

function name(parameters){



is like another way of using the arrow function written differently

Functions with one parameter doesn’t need () and {}

Scope refers to where a variable can be accessed in a program.

Variables declared outside of {} have a global scope

Better to avoid using global scope as it tends to clash with other variables


A real challenge I’ve faced is understanding the ‘for’ function in python.  It also gets very confusing with lists and dictionaries for me. I’ll probably come back to this later at some point. Just this entire lesson took much longer than the last 2 and took me about 4 times as long compared to the other lessons. I’m really feeling the challenges of coding. (Even though I know this is meant to be easy)


Daily Challenge:

This daily challenge was much more tough in my opinion compared to the other ones. I didn’t have a path I wanted to take as soon as the challenge started and helped me be more creative. To help me figure out how to get random numbers, I google searched and use this website to help me with this daily challenge. https://www.pythoncentral.io/how-to-generate-a-random-number-in-python/ . This was what my first attempt(first image) looked like and after going back to python and reviewing carefully, I came up with this new code. (second image) I feel as if there’s something wrong with it as I haven’t been able to get a correct answer after around a 100 attempts. So I checked by reducing the numbers available to just 1. This will make the sum 2 always. It still said wrong so I also made it print the diceSum and it came up as two. I type in 2 and it still says I’m wrong. I don’t know what to do after this, so in the meantime I’ll just submit this for now (third image).