Posted on

25/10/13 – Python Challenges (Most Efficient Solutions in the Class!)

This was the last lesson before of the half term, and we were given a set of challenges to do in our given groups. The only way we could progress on to the next challenge was by completing the first. The winners would be the ones with the most challenges completed by the end of the lesson.

My group consisted of Myself, Zain, Mithunan and Arjun, and although our evidence is to be posted on separate blogs (and it is), I have posted my own copy o it on my as well. We finished 3 challenges:

1. We see 32 written slightly above 2. Our first guess was to type up 238 in the URL, however we were told to try something else by an error site which was eventually opened. So we eventually figured out the the reason for the 38 being above the 2 was because we wanted to find the 38th power of 2. So we figured out the answer to 2 ** 38 (274877906944) and entered it in the URL, which took us to the next challenge.

Screen Shot 2013-10-27 at 11.59.40

Screen Shot 2013-10-27 at 12.00.35

2. The next challenge involved cracking a code. The hint suggested we think TWICE, so we decided to translate the code given by going 2 letters higher each time. After entering this into the URL we realised it was’t the correct answer. So we looked again, and saw that the URL had the word ‘map’ in it. We went 2 letter higher on each letter of ‘map’ (‘ocr’), and we were taken on to the next challenge.

Screen Shot 2013-10-27 at 12.04.29Screen Shot 2013-10-27 at 12.04.41

To help with the efficiency of solving this challenge, I created a program in python which would do this for us:

Screen Shot 2013-10-29 at 23.25.17

 

This program refers each letter in a word to a dictionary and then increase the index of each letter in the word by 2, and refers the new index to the dictionary.

The output is as follows:

Screen Shot 2013-10-29 at 23.25.45

3. This challenge told us to look at the SOURCE of the page. I knew this was referring to the source code of the page. Here was a comment with a mess of random characters, and were told to find the rare characters in it. To my knowledge all the groups who attempted this challenge used the CONTROL+F browser function which looked up characters on the page. The word was ‘EQUALITY’.

Screen Shot 2013-10-27 at 12.33.19Screen Shot 2013-10-27 at 12.12.53Screen Shot 2013-10-27 at 12.37.12

However, I felt this method to be greatly inefficient, and I made a python program for this as well. This takes in the large string as input, and if the characters in the string were not in the alphabet (using the NOT IN function), we append the to a list, if they are in the alphabet we append them to another list. After iterating through the list we print out the list with the word in the alphabet which have been picked up. This give us the output of  [‘e’, ‘q’, ‘u’, ‘a’, ‘l’, ‘i’, ‘t’, ‘y’]. All the steps involved in my program are shown below:

1.Screen Shot 2013-10-27 at 12.35.11

2.Screen Shot 2013-10-27 at 12.38.283.Screen Shot 2013-10-27 at 12.38.49

One response to “25/10/13 – Python Challenges (Most Efficient Solutions in the Class!)

  1. Mithunan ⋅

    Good Work Rajat

Leave a comment