Final Project Progress Report 2 (Prototype 2) June 30 Day 8

2. In-depth reflection – what did you learn 

Through-out improving my prototype, I enjoyed spotting out weak areas and being able to learn from my mistakes. I feel much better with this new prototype, however, I can definitely incorporate more aspects into my final product. As I am getting closer and closer to my empathetic goal of spreading effective passwords to my peers and community in Hong Kong, I am recognizing how secure our world would be if we all had a password from my generator now. I actually feel like my passwords will make it tougher for hackers to do illegal activity, which makes me feel like I can make my final prototype amazing. Starting off I needed to define some issues currently in my code. Which are the mul_pi function returning a two digit number, disorganized code, random_caps only returning capital letters, and no option for the user if he types in an invalid phrase. (Also, my code could have many more features, a lot of which I implement in the final product). I needed to ideate some solutions addressing these issues in my previous prototype. I managed to brainstorm a way to fix the conFU function and allowed it to replace the location of letters and numbers instead of just letters previously. You could just add numbers to the keys of the dictionary, and letters as its values, but I wanted to find a smarter and faster way of doing it. Another improvement was organizing the code and editing variable names like new_sequence to make variables consistent and overall making the code easier to read. Then I also needed to fix my random_caps function, as it would only capitalize letters, and not lowercase them even if randint resulted with 0, or false. All I had to do was add a .lower() to the losing statement. Finally, I needed to edit my welcome prompts, to address if the user types in something extraneous. I created a while loop so that the user wouldn’t be kicked out unless he answers yes or no, while specifying that he has to in the case that he doesn’t. Also, I learned about a real unique function that I had never known about, the exit() function. Say if you had more blocks of code in front of your while loop, using break would lead the computer to the next lines out of the loop. But if you just want to exit without running those lines, you can use exit(), which will completely abrupt the program.


I got an error from trying to iterate over a dictionary and make changes to it at the same time, and it took me quite some time to find out about the .copy() function, which lets you iterate the copy, and add to the original function. This allowed me to add the opposite values of the letters to the keys and their values as letters, which is faster than listing it manually.

Also, unfortunately, I could not get the mul_pi function to return only one digit from 0-9, as I was still unsure, but am still brainstorming a way.

Testing: Working as intended as nothing too major was done, but I could still definitely add more features in my final product:

4. Other resources you came across in this learning process?

Thanks to my peers for the support and clarifying my questions.

This taught me how to use the .copy() function

Final Project Progress Report 1 (Prototype 1) June 30’th Day 9


2. In-depth reflection – what did you learn 

Coming into this project I didn’t know what to think of attempting to crack down on a current huge world issue, illegal online activity/hacking, and database cracking. But while producing my code I managed to channel that empathy and worry I have for our digital world today, into making a complicated and effective password randomizer. I would not be happy to share this to people yet, but soon after a few more prototypes, I think it will become a masterpiece. I hope that my password generator will spread awareness to people in Hong Kong, and people or businesses in need of this can get access to it for free as it is shared around.While starting off this program, I knew it had to have multiple algorithms that are difficult to crack, because of how secure and smart hackers can be, I defined my goal to make this password generator have complicated algorithm that would be tough to breach This algorithm consists of six parts, generate sequence, switcheroo, multiply pi, random caps_lock assignment, flip, and generate password. In order to construct these algorithms, I had to ideate the most realistic and coherent way to program them. I thought of using topics of my understanding so that I wouldn’t have to rely on researching all the time, but have outside topics and extra functions to research. Starting off in order to generate my sequence I needed to import a library called ascii_letters, and digits, and store them in alphanums variable. Then I used from the random library, the import choice to choose 12 selections from alphanums, that will generate the sequence. After that, I had to reverse certain letters for numbers, which I could do by using a for loop. I added the letters parallel to the new_sequence if a letter in the original sequence is in the dictionary, and otherwise just add the letter if it’s not in the dictionary. Then I multiplied all the numbers in the sequence by pi, by checking if it is a digit and converting to an int to multiply, and back to a string. My third step to randomly capitalize letters, worked by scanning to check if there are letters in the sequence, and if so use the randint function to generate a number, if it is true, (1), .upper(), otherwise leave it. Finally, I flipped the password by adding to a new sequence with every letter on the left (i), making it reversed, and then stated all the functions equal to a variable, which ended up giving me the password.

AS this is prototype one for me, there is still a lot of progress to be made, such as reversing numbers for letters in my conFU function to make it go two ways. as shown here, it only checks confusers keys (letters), but not the numbers.

Making a password generator for the first time was surely not the easiest, as I would get stuck on little parts like not knowing I had to use a dictionary to swap letters in a sequence.. Especially functions like and wonder which modules I should be importing, as I was new to the ASCII and digit library I had to ask for some assistance.

  <– In this situation, I had to multiply all the numbers in a given sequence against pi and wasn’t sure about how to keep the digit rounded to one digit between 0 and 9, I manage to correct this later in my final prototype. Also, I got confused with the input of each function, thinking the variable it returned should be inputted into the next function, when really what is returned is the sequence, the variable just representing it. Therefore I had to use my variable name to store the password, sequence.

Finally, the testing prototype one was successful for me, and only took a few syntax corrections to get my code to work, here is the result: 

4. Other resources you came across in this learning process?

Thanks to my peers for the support and clarifying my questions. No other help was taken.

I2P-Krish_Galani-Day#8 Mini Project 2 (Hangman Game)

2. In depth reflection  (Screenshots or copy/paste code here to help describe your learning process)

When first approaching this game, I had no idea how I was going to store each letter that is guessed. It didn’t come to me straight away that I should use a dictionary and booleans, until I started fiddling around with lists. I tried to delete a letter from a list if their letter was in the letters of the word_to_guess. But this just ended up getting me confused with assignments, and having trouble replacing underscores ‘_’ with the correct letters guessed. At a certain point, I thought you could assign a new character to a string by doing a[2] = (assignment). Which I was wrong and this lead to a str item assignment error. After a period of frustration not knowing how to tackle this issue, I related back to my previous assignments and realized the importance of a dictionary in this game. Eventually, I got the game to work around the centerpiece of a dictionary with letters of the word to guess, and those letters would turn True if they were guessed, whereas if the whole word is guessed, it will recognize that and end the loop if correct. Starting off: I imported a choosing function to choose from a bank of random words that the user will have to guess from. Then I created mode, which would determine the difficulty of the game. Difficulty is based on a number of guesses you get to guess the word, depending on what mode the user specifies, e.g. ‘ easy ‘ would give you 14 attempts to crack the word, which is 14 loops in the mainframe checking and printing process. After setting the mode, I used choice to generate a word and store each letter in a dictionary with a false condition. After that, I start the loop with a variable ‘turns’ to keep track of the current turn it is and act as a counting system. Then I create a display function for the word, check each letter in guessed_chars, if it is true, print it, otherwise print ‘ _ ‘. Now I take the users input and make a cheat conditional to make it easier for my screencast (below) and tell me the word if I want it, it doesn’t count as a turn. My mainframe consists of an input that relays against three conditions, if the user’s input has more than one character, check to see if it matches the word, if so, print and end the loop, if doesn’t print and add a turn. The other conditional is if they input one character, check if that letter is in word_to_guess, if so make it true in guessed_chars so it will be printed in the next loop, if the input is incorrect, print and add a turn. Otherwise, if the input is empty, print and reloop. After the mainframe, there I defined all_guessed to check if all the values of the keys in guessed_chars are true, meaning the user guessed all letters if all_guessed = True. Otherwise, all guessed is false. Then if all_guessed == True, break from the loop. Finally to determine if somebody has won, check if turns == the mode (max turns given), if so that means he ran out of guesses and therefore loses, but otherwise if somewhere before the max guesses the user breaks from the loop, they will win because they have guessed the word before the guess limit, which will lead to the else statement telling the user they won. If they run out of guesses, the loop will become false, and turns == mode will become true, printing a loss statement.

Screencast of this program working: HERE

4. Other resources you came across in this learning process?

Thanks to my peers for the support and clarifying my questions. No other help/resources used.

I2P-Krish_Galani-Day#6 (June 24-25) Weekend Project

1. Screenshots of your achieved daily units from Codecademy (PYTHON and JAVASCRIPT/GOOGLESCRIPT)

All Units Completed in previous blogs.

2. In depth reflection – what did you learn whilst completing the units on Codecademy and any challenges you faced. (Screenshots or copy/paste code here to help describe your learning process)

The weekend project was quite an interesting one and got me out of my coding comfort zone as aspects of life were brought, making me ideate outside of just programming. When at first looking at this project, I immediately decided on making a flowchart on ‘How to travel to HKIS’, for I’ve lived here all my life and I’m quite confident on that topic. However, I was confused as to why we were doing a flowchart. Eventually ,while constructing the flowchart. I realized this end to end demonstration could potentially help many people around Hong Kong, and drastically help people locate HKIS, as it is in a tricky geological location between a reservoir and mountains. I came to an epiphany that by making a program based on my flowchart would not only encourage more people to try it out, but also encourage them to send it to their friends in need of help. The power of programming simulations is powerful and can benefit people in many ways.

How to travel to HKIS Flowchart - Krish_Weekend_Project 2017


I utilized the website to create this flowchart, as I have used it in the past, I have experience in this software. My favorite part of is that it has a simple and understandable User Interface, while also being integrated with Google Drive making it easy. While making the flowchart, I had to be very careful of how I organized the questions, because some questions lead to the same answer. For example the questions ‘South west Hong Kong Island?’ and ‘South west’ are part of two different outer questions, but due to further conditions lead to the same answer, I had to put those questions nearer to each other so that I wouldn’t have to repeat answers as much. Also I had to take into consideration readability and organizing the arrows in a coherent and introducing manner.

3. Reflection of your daily challenge, copy and paste your code, add a series of screenshots to prove this. (Tasks to be completed can be found in Course Description I2P summer 2017)

Python Interactive Flowchart of ‘How to travel to HKIS’: 

Screen Shot 2017-06-26 at 7.14.41 pm Screen Shot 2017-06-26 at 7.15.38 pm Screen Shot 2017-06-26 at 7.15.52 pm Screen Shot 2017-06-26 at 7.17.33 pm

One hundred and five lines of code. You can imagine the organization, planning and construction methods I implemented to making sure my syntax and indents are all correct. The code mainly consists of many prompts followed by the conditionals according to my flowchart, all tied together by a while statement that can only be broken if the user reaches their answer or types ‘exit’. When approaching translating the flowchart into an interactive program. I couldn’t simply start anywhere, I had to think about the best order to program it  in. After a while of thinking, I started by listing out all the prompts/inputs for the user, which are all the question in the flowchart. This way I could cut and paste them wherever was necessary later on. Then I made the while statement equal to true, because I was going to put in breaks at the end of results later on. After that I stated the big question of if the user wants to travel to HKIS, and made conditionals of user responses, including an ‘exit’ response that would immediately break the loop. After that I basically I kept putting conditionals of responses in responses of conditionals based off my flow chart from macro view to micro questions like ‘South west?’. I kept diluting the questions down to their specific location, which then I would respond with an answer, and break. Overall, for almost every prompt I had to write an if elif, and else statement for yes, no and if their answer was invalid, while assuring the answer is not caPs Sensitive by using .upper(). As you see in my result, I entered one of the possible paths, and it succeeded giving back accurate instructions.

4. Other resources you came across in this learning process?

I heavily relied on this to solidify and confirm my understanding of the the routes going to Tai Tam Road, and finding geological interference.

The official City Bus routes website listed above helped me understand which buses departed from which locations, and to judge which bus to take in order to reach a destination.

I2P-Krish_Galani-Day#5(June 23)

1. Screenshots of your achieved daily units from Codecademy (PYTHON and JAVASCRIPT/GOOGLESCRIPT)

I didn’t find the time to explore Optional Units 10-11 due to spending a lot of time on the previous Optional (Bitwise Operators), and this Google Script Challenge.

2. In depth reflection – what did you learn whilst completing this activity, any challenges you faced. (Screenshots or copy/paste code here to help describe your learning process)

Google Script Auction Setup/Challenge :

Whew, what a day it has been. Coming in to this challenge I was clueless, with no idea how to start. I legitimately spent hours trying to do this challenge without actually studying the language/functions or knowing how Google Script works. I was lost, randomly fiddling around with numbers and options hoping things would work out the way I wanted. This was my worse mistake, because not only did it waste my time, but I wasn’t learning anything from it and the point of this exercise is to familiarize myself with Google Script and how it works with Google Sheets/Forms. Thankfully, after being hinted and suggested to use certain resources like the email sender function. I felt like I could guide myself onward and research everything from there, because I had somewhere to start. Before I go into the detailed steps and the actual process I carried out to achieve a fully functional Bidding Simulation, I want to express what I have learned of Google Script and why it is unique to me. Google Script is much like JavaScript, but has many custom functions and sheet connected methods. I personally feel that this is what makes Google Script so fun and flexible to code with, as there is a whole community helping and learning how to use googles app scripts together. From viewing all the many complex different projects that people can create, and foreseeing the potential in making more advanced simulations, I feel inspired to make more cool simulations using Google Script in the future, and explore the language further.  How I did it: Starting from the top, I was assigned to simulate an Auction selling a car using the inner coding of Google Sheets(Google Script). First I had to gather input, and in order to do this I created a form –> 13845812f247b92ec7b635ea38278708 This form collects three key inputs, their Name (to refer as), Email Address(to contact them), and their Bid(to compare against others). But of-course I can’t just make a plain form, there has to be somewhere for the data to be recorded. I simply attached a google sheet to this form with a click of a button, and every new entry I submitted would become a new row. 5da0cd2c91113d03f3ec20b24a19fa32 Also the columns are the prompts organized. I will get into ‘Message’ later. Column A is automatically ignored because it is a Timestamp. Once I had a sufficient amount of people in the Auction, I needed to address how I could contact these bidders using a function to tell them if they have lost or not, as I have all their emails. Instead of manually typing in who won by looking at the numbers, I decided to go further and look for a function that could find the biggest number in a column, and automatically declare a winner. After researching for a while, I found this: db9dc60b60f9efd582b943eddb244494 Basically what this function does, is first accepts an argument input of the column to scan, locates the sheet, then obtains the values of that column specified. Finally after that it will use the .sort() function and arithmetical operations to deduce the largest number of the column. Now that I have a way of detecting the largest bid, I don’t have to constantly change my message, but I can simply call the getMaxInColumn function in the script editor. I was suggested to use ‘’, and found its very simple to understand, for the only things you have to change are the column and row numbers based on where your info is. However, it wasn’t so easy for me, because I didn’t just want to send an email with a message, I wanted multiple aspects involved in returning if you won or not and to make use of all the user input information.  email As you can see in the following, there are certain things that I changed from default email function provided. First off after defining the function, I created something that was not on the original. By referring to a reference sheet of all the functions you can use in google script ( linked in resources). I learned that you could use something called .getLastRow(), by using the format of google script (SpreadsheetApp.getActiveSpreadsheet()) I could easily store the value of the last row in the variable lastRow. Then I applied that variable to the number of rows to be processed. This helps me drastically in the sense that I don’t have to keep updating the number of rows to process for each form submission, because the variable lastRow is constantly being changed for every form submission. Moving on, sendEmails() function will iterate over the email addresses column, which is row[1] because the first index is 0. Then I apply my own custom message to the var message. Because it is all under a for loop, it will repeat for every submission there is, (form submissions or rows), as it goes down the rows, I ask it to print out every row value in column 3, which is their initial bid, and concatenate that with the message, and finally concatenate the highest value in the bids column. I set up the message in the google sheet in a way that coherently shows their initial bid + message + winning bid. After that, I just customize the subject, adding each of their names at the end (row[0]). Finally this emailing function will take all these pieces of information by its boundaries specified , and iterate over the whole for loom, in doing so the Mailapp  will send an email to each iteration in var emailAddress using the information provided by message and subject as content. 21b0c4c024aca1b68bee84eb9953d392 (Referring to Left) When making an auction, usually I wouldn’t set a trigger to send emails, for I would wait for a good amount of bids, then click run on the email function once to email everyone the result. However, if the auction is still in its developing phase and I want to send the user a ‘receipt’ after he has placed a bid,   while also reporting to everyone else the latest person that has entered the auction and how much they bid. I can use this on form submit button, and change the message to something like (‘row[0] + ‘has entered the auction with ‘ + row[3])

which would report to not only you, but everyone else in the auction the latest bid, so that others can bid higher. 14acac375f046e90c922e61367b943dd(Reffering to the Left) Here is evidence of my current emailing function working: As you can see I let the users bid, then see if they won afterwards. But, as I described above, I could also definitely let the users bid multiple times, based on the latest highest bids they would see coming in their emails every ‘On form submit’. Overall I had a really great experience learning about the involvement of behind the scene scripts with google forms, and make a functioning bid guessing type auction.

3. Reflection of your daily challenge, copy and paste your code, add a series of screenshots to prove this. (Tasks to be completed can be found in Course Description I2P summer 2017)

Python Challenge: Encrypt / Decrypt Message :

1 2 result


Personally I feel that everything I had to do to complete this program, makes this challenge was challenging and fun! It not only required me to go back Codecademy Units/Lessons and refresh my memory on older concepts like Functions, Dictionaries, and modifying elements in Dicts. But also challenged me to apply my recent skills on the recent units in python(exam statistics which is function based), and (advanced topics in python, ‘in’ function). Overall providing a flow of Units to consider while thinking of how to code this challenge. When I first brainstormed methods to make this program, I immediately thought of making a dictionary to store the alphabet to encryption translations, and vice versa for decryption. As presented in my code above, I made an encryption dictionary where I stated the alphabet(keys), and gave it encrypted(values). For the decryption dictionary, I didn’t need to state all the opposite values in a new dictionary manually. But I simply used iteration methods above to store all the values of the encryption dictionary, as the keys of the decryption dictionary I made {}, and vice versa. This allowed me to later on iterate over the decrypted dictionary to result in the reverse of the encrypted word. Then I decided after a while of consideration, to organize my encryption and decryption iteration blocks in functions, so that I could simply call the function in conditional statements later on. I started off with function enCrypt, with an argument (word), which will be the word the person inputs. Then I make (encrypted_word) to store the result which is their soon to be encrypted word. As I iterate through their word, I make sure to use [key] to log every character in their word against the encrypted_dictionary, and when that character matches up with the encrypted dictionary, it will take its value and store it into encrypted_word. This process will keep adding values to encrypted_word for the keys in their word, and finally I return the encrypted_word. This process of iteration is the same for function deCrypt, except it matches up [key] in word against the decryption dictionary, not the encrypted dictionary, giving it the opposite formation, which will return the decrypted word. After I have declared my functions, I move on to the interface, and conditionals. I first create an infinite while loop that can only be broken if the user types ‘exit’ into the prompt (path) that will keep repeating after every action. Then I declare my conditionals, if the user types encrypt, decrypt, or something else. If the user types encrypt, they will be prompted for a word (string), which is entered into the encrypt function’s (argument) that is called. the result of enCrypt function with the users string input will be stored into a new variable, that prints out a sentence declaring their encrypted word using concatenation. For when user types decrypt, the same process will happen as enCrypt, except it will call the deCrypt function against the users input. Finally if the user enters an invalid term, it will suggest that they enter one of the valid terms, encrypt, decrypt, or exit.


4. Other resources you came across in this learning process?

Thanks to Mrs. Mok for the helpful hints!

Showed me how to send emails based off a sheet.

I used a function here to find the maximum value in the Bid column to then apply that in the message sent to all.

This webpage shows all the different types of functions and how to use them. I used this to learn how to do .getLastRow

I2P-Krish_Galani-Day#4 (June 22)

1. Screenshots of your achieved daily units from Codecademy (PYTHON and JAVASCRIPT/GOOGLESCRIPT)


I finished the last two Units of JavaScript(Unit 7&8) which was exciting, and completed Units (9-10) in Python while doing an additional optional lesson, Bitwise Operators. I had already talked about Unit 7 in the previous blog.

2. In depth reflection – what did you learn whilst completing the units on Codecademy and any challenges you faced. (Screenshots or copy/paste code here to help describe your learning process)

Wow, I have learned a lot in just a week. Working, learning, and improving everyday to the best of my ability has rewarded me with a superb understanding of both JavaScript and Python. I am super grateful for the opportunities brought forward for me to learning to code, for the concepts I have learned in these last few Units really tickled my Computer Science bone, and got me pumped to make many programs using the knowledge I now have. I feel like I just took a huge leap forward to becoming proficient in computer science and I really want to thank Mrs. Mok for running the course this summer! It has really taught me better self-discipline and a wide range of coding skills. I also feel a ton more confident going into AP Computer Science next year, for I now have great knowledge in Python and JavaScript. I feel enlightened learning about these amazing advanced topics like Classes, List Slicing,  Lambda syntax, and especially Bitwise Operators. My friend Ben really inspired me to learn about Bitwise Operators, for he shared you could make all kinds of tricky programs and magic , and linked me a page ( I think that the fact that Bitwise Operators was so taunting to me, compelled me to take the challenge and get through it. After successfully completing Bitcoin Operators, I feel it was definitely worth it, for it is the roots of code and very beneficial to know. Although binaries took me a painful amount of time to figure out how it works in base two compared to base ten(what we use), once I did understand binaries I kind of felt like The Matrix. Mainly knowing how to translating from base 10 to 2  and knowing how bits work(columns)was the hardest part for me, but once you I knew how, operators were easy to implement. Here are examples of places that I got stuck while learning these Units:  inherconf protofunc conf (<—Referring to Left) I would often when writing out class constructors for objects, get the inheritance  function (gives all traits) mixed up with function prototype (a function everyone in that class has access to) I had to remember if it says function afterwards its a class function, if there is a another class on the other end, it is inheritance for that class.typeof(<–Referring to Left) Next up in this situation I was unsure of what the function (typeof) did, and how it worked in iterating languages. After further research I understood it was checking for if the value of that key is a string, log it, otherwise if it is something other than a string, skip to the next [x].

 return balance (<–Referring to Left) In this scenario I was dealing with a class constructor and couldn’t resolve how I would call a private variable publicly, which I needed to do in order to display myBalance. After some troubleshooting, I realized I could declare a public function inbuilt in Person to return the private function (returnBalance). This worked because when I called the public function (.askTeller) in the object john I had created, it would return the private function of (returnBalance), which then I made myBalance to return the arguments inside returnBalance, then logged it and got 7500, which is bankBalance.

e.g.conf(<–Referring to Left) Here I didn’t know that Object.prototype was an actual object, which confused me, It made  more sense when the console.log statement returned Object, then I realized it was trying to log the type of an object, which would return Object. Finally  on line 5 I didn’t know what .hasOwnProperty was or baggage in an object. After being taught that every object has some baggage, I checked if Object.prototype had the property hasOwnProperty, and it returned true, further proving my point.

lasttransac(<–Referring to Left) Here was a confusion I had in applying the lastTransactionAmount method. I was looking in every place other than the add function, and trying different scan methods to log the lastTransaction, but they all didn’t work. A friend of mine hinted that I should be doing it inside the add :function, and from there I realized that simply the itemCost is updated for every scan, so the lastest itemCost, will be the lastTransaction.

binary(<–Referring to Left) This was the last exercise in the Bitwise Operators lesson was pretty hard for me to comprehend. However now I have a strong understanding of what it does. It takes the imputed number as the number you would like to flip, then n as how far towards the left of that number would you like to start the flipping, -1 because shifting a value always has to be one bit less because of decimal location. Then result will use the XOR(^) operation to flip the number against mask, this will work because shifting 0b1 left to the n value you specify, will simply create 0’s to appear on the right side of 1 , and when comparing in the XOR operation  if either of the corresponding bits of the two numbers are 1, but not both, it will flip, then it returns the result in binary. This function flipper is usually meant for binary numbers to be imputed but you can use a regular number like I did (34,7)

As I talked about JavaScript Objects 1 (Unit 7) in the previous blog really JavaScript’s Objects ii(Unit 8) was way more complex than Units 9-10 in python to me, other than Bitwise Operators in Python, that was the hardest and took a lot of my time to complete, but totally worth it.

3. Reflection of your daily challenge, copy and paste your code, add a series of screenshots to prove this. (Tasks to be completed can be found in Course Description I2P summer 2017)


I found making this Python Guessing Game to be fairly easy, first I imported the function randrange from the library random, and use it to make my lucky_number. Afterwards, even though the challenge description for this challenge didn’t say anything about logging the amount of guesses taken to win , I did it anyways because it wasn’t too hard and wanted to make this program cooler in that way. Therefore I setup guesses = 0, to be read out in the winning statement, this works because after every response to prompt, and  before the conditionals, guess+=1, making the number of guesses increase immediately after you type your guess. Going back to the maincode, I declare a while loop equal to True so that the function wont end until they guess the lucky_number, where it will break. I declare a prompt for them to guess, and if prompt is.decimal() is not true, meaning if there is no number in the string prompt, print the statement, else if they did put a ‘#’, start the game, immediately like said earlier guesses+=1 because they just took a guess, THEN the statements are checked, first I change their string answer to an int so it can be varied agaisnt the conditions, if the number is greater, print the number is larger statement, and vice versa to if the number is smaller. But if their number == lucky_number. Print the winning statement, with number of guesses concatenated , then break out of the loop.



I pretty much used the same format of the Guessing Game in Python, in JavaScript, but translated the words to make sense in JavaScript. The only hard part about coding this was I kept thinking something was wrong with my code, when there wasn’t anything wrong. I thought it infinitely prompted to guess a number and nothing went through, later on I realized my numbers were going through, but the judging statements(greater or lower statements) weren’t showing up because I needed to change them to confirms() for them to show up. Because the console.logs only show up after the program has ended. Also, I couldn’t figure out how to filter whole numbers, until I read about parseInt(), which is like .isdecimal() in python. I had to test this in codecademy because I had no other interpreter for JavaScript. It worked as you can watch in the video I uploaded demonstrating it : Playing the JavaScript Guessing Game .

4. Other resources you came across in this learning process?

I learned that .this is an object method in JavaScript.

This video helped me understand how to add numbers in binary and tell what a number in base 10, is in binary (base 2).

Also I got real help from people in ‘The Coding Den’ group on an app called  ‘Discord’, they hint me when I’m stuck and share tips.

This document helped me reinforce my understanding of how exactly to use .isdecimal(), I learned you can use it for whole numbers.

Thanks to peers for the assistance :) Wouldn’t be able to persevere with-out people by my side.

I2P-Krish_Galani-Day#3(June 21)

1. Screenshots of your achieved daily units from Codecademy (PYTHON and JAVASCRIPT/GOOGLESCRIPT)



I completed Units 7-8 in Python, (Lists&Functions and Loops), and also did Units 5-7 in JavaScript (Control Flow, Data Structures, and Objects) Including the Address Book Challenge in Javascript.


2. In depth reflection – what did you learn whilst completing the units on Codecademy and any challenges you faced. (Screenshots or copy/paste code here to help describe your learning process)

I cannot believe the amount of things I’ve learned going through these past couple of units in JavaScript and Python. I feel as though everything was calm, smooth going through the first few units, then all of a sudden we get front-loaded with a bunch of units filled with a lot of information. I really wanted to make sure that I fully understood these concepts and would not forget the concepts I learned as I went by them, which is why it took me two days to get past this learning point/blog. I definitely feel strong in certain topics like Objects in JavaScript, and conditionals,  functions, (lists&functions) especially. While there were some sticky topics I pended over for a significant amount of time to gain a better understanding, such as Battleship, using functions such as (zip),enumerate(),(in), (for loops in python), and the insanely hard lesson for me in Unit 8 (Python): ‘Practice Makes Perfect’. I feel so accomplished and confident in all the new skills I have, and feel that taking a day to reinforce all my previous knowledge really benefited me, especially in allowed me to make such a complex Python Calendar. I love the nature of coding that JavaScript provides, as I still prefer the format of coding of JavaScript over Python, even though there were parts that confused me in writing methods, and custom constructors in JavaScript. Here are some examples of problems I had trouble with:

97a6f676f2af28919a7750c67a33980c (<–Referring to Left) I was confused over how I could search for a name specifically, and kept trying a bunch of nonsense, until I found out you can access firstnames by going through (friends) with a for loop, and using .firstName to look specifically at the firstName.

battleship (<– Referring to the Left) Moving on to Battleship, (my favorite program to build so far besides the Calendar). I thought it was really cool that you could display an actual 2d board with code, however, I didn’t always code it correctly on first try, it did take some trial and errors to make everything work in harmony. For example, I was unsure of how to implement 4 turns in the game, showing my insecurity of for loops in python at that time. But after testing for a bit I found out for turn in range(4) meant for every number up to 4, carry out the conditions, giving it 4 times to be repeated, at (1,2,3,4) because at the end I did turn +1, which makes it so that there isn’t a turn(0). Next up, I had immense trouble with Unit 8’s ‘Practice Makes Perfect’. Next up, I did feel that the ‘Practice Makes Perfect’ Unit 8 Lesson required a lot of code sense, and how to enact general logic for statements into actual code, which I wasn’t so strong in doing at the time, because I was used to following instructions. One of the reasons why I spent a day reinforcing my understandings is because of that, to generate a sense of code logic. (Referring to the Right –>)antifact These kinds of problems really challenged my creativity and application of previous skills. Like I said earlier, I lacked logic to code these functions, and needed assistance from peers to hint at potential methods in making them. In the first problem I failed to remember that (every) meant every letter in text, and also didn’t remember to use (not in) when checking something, this led me to experiment coding non-resulting functions, until I got assistance. The same effect rippled for the coding of a factorial function, I couldn’t come up with the idea of using range(x), and instead did multiplication tables and many extraordinary coding methods that were way off from deducing the factorial of a number, eventually I got help and learned to use a repeating(product) process based off the items in range(x), which outputs factorial. Overall these were the types of problems I struggled with, for loops, code logic, method functions, custom constructors, etc, but in the end taking a day to review it all has removed any doubt I have in coding these learning targets, and made me more confident in my skills than ever.

3. Reflection of your daily challenge, copy and paste your code, add a series of screenshots to prove this. (Tasks to be completed can be found in Course Description I2P summer 2017)

Javascript: Building an Address Book

5d183c2b0dc1542c05e10499afecf299 I found the contacts list to be fairly easy, for the only place I got confused at was the last part at (function add). I was confused of how to append a new contact to the end, soon realizing that if you attach a object to the end most index of an array(contacts.length), its the same as appending.

Python: Calendar Challenge

Screen Shot 2017-06-23 at 7.05.16 am

I cannot believe I actually got this super complex program to work, I’m seriously astonished that I managed to pass this challenge, for it was super tough, and chunked a lot of my day time. When first approaching this, I spend at least an hour brainstorming the best possible way to approach a calendar. “Should I make a list inside an array?”, I asked myself many questions to determine which approach would work best with a calendar. Finally, I came to the conclusion that an array with keys as the dates, and lists are their value (content) would be the smartest way to store an event. When starting this code, I had to create the events dictionary to hold the events, then I used a while statement to prevent the program from ending unless specified by the user. After that I created three scenarios to a question of what to do, if the user typed view, it would print out each event in the dictionary events, (I used a for loop to call all the events). If the user types add, they will be prompted with a question of the content and date of their new event, then whether or not the date the user gave is new or not, it will either store it inside an existing date, or make a new event(new date). Finally it will print calendar with the new information. If the user responds with update, and the date of event that they inputted is listed in events{}, they will be prompted to select the content in that date in which they want to change, then what to change it with. When the user responds with delete,  it works the same way finding what to delete, as replace does, except in the end instead of replacing the content, you can delete it. Finally, I made it so that at the end of every action, the user would be prompted to if they want to break the loop or not, if they say N, they can keep doing procedures, if they say Y , the loop will break. If the user doesn’t type a valid keyword, the else statement, will tell them to. Overall this exercise really brought back a lot of forgotten skills for me, and is definitely the most complex program I have ever made! I really have to give my thanks to all my peers who helped me to debug and ‘The Coding Den’ group to help me get passed stuck-ups.

4. Other resources you came across in this learning process?

I used this to help inspire how to write a factorial function when I got stumped.

I also used the above to help me and reinforce understanding when I got stumped on is_prime, reversed function, and more exercises for string function challenges in ‘Practice Makes Perfect’ (Unit 8 Python).

Also I got real help from people in ‘The Coding Den’ group on an app called  ‘Discord’

Thanks to peers for the assistance 🙂