Hi!
Recently I've enrolled in Google Foobar challenge, and it is fun fun fun if you love programming. :)
After level 2, I've got an invite link to share with someone. Since I don't know a lot of people interested in this, or they don't have the time, haven't shared it with anyone yet, but I am also not sure if it is still active. Anyway, I am going to paste it here, so someone might want to try it. I hope it still works:
https://foobar.withgoogle.com/?eid=wmp5V
Here's a heads-up what will be your first task, and how to solve it in Python, although it is pretty simple (but get ready for the brainstorming ones):
Challenge:
Because Commander Lambda is an equal-opportunity despot, she has several visually-impaired minions. But she never bothered to follow intergalactic standards for workplace accommodations, so those minions have a hard time navigating her space station. You figure printing out Braille signs will help them, and – since you’ll be promoting efficiency at the same time – increase your chances of a promotion. Braille is a writing system used to read by touch instead of by sight. Each character is composed of 6 dots in a 2×3 grid, where each dot can either be a bump or be flat (no bump). You plan to translate the signs around the space station to Braille so that the minions under Commander Lambda’s command can feel the bumps on the signs and “read” the text with their touch. The special printer which can print the bumps onto the signs expects the dots in the following order:
1 4
2 5
3 6
So given the plain text word “code”, you get the Braille dots:
11 10 11 10
00 01 01 01
00 10 00 00
Write a function where 1 represents a bump and 0 represents no bump. Put together, “code” becomes the output string “100100101010100110100010”.
Write a function solution(plaintext) that takes a string parameter and returns a string of 1’s and 0’s representing the bumps and absence of bumps in the input string. Your function should be able to encode the 26 lowercase letters, handle capital letters by adding a Braille capitalization mark before that character, and use a blank character (000000) for spaces. All signs on the space station are less than fifty characters long and use only letters and spaces.
def solution(plaintext):
output = ""
for i in range(0, len(plaintext)):
if plaintext[i].isupper():
output+='000001'
output+=braille[ascii.index(plaintext[i].lower())]
return output
ascii = [
' ', 'a', 'b', 'c', 'd',
'e', 'f', 'g', 'h', 'i',
'j', 'k', 'l', 'm', 'n',
'o', 'p', 'q', 'r', 's',
't', 'u', 'v', 'w', 'x',
'y', 'z']
braille = [
'000000', '100000', '110000', '100100', '100110',
'100010', '110100', '110110', '110010', '010100',
'010110', '101000', '111000', '101100', '101110',
'101010', '111100', '111110', '111010', '011100',
'011110', '101001', '111001', '010111', '101101',
'101111', '101011']
That would be all for this post, c ya in the next one!
:)