You know what’s more fun than coding..? Coding together with a friend!! So that's exactly what we're doing today!
I called my friend Beatrice and we created a design that becomes complete by putting two imagiCharms (or two phone screens) next to each other.
That is your challenge for #day8 - create a design together with a friend - you can create an image that needs more space than the 8*8 matrix provides or maybe make an animation jumping from one matrix to the other? 😉
When you share your project with the community make sure to add the tag #day8 🙌
For the example project, we used a data type called dictionary
to map different colors to each day of the week. A dictionary is a collection of key-value pairs. In our case the day of the week is they key
and the assigned color is the value
. It works just like a real dictionary, where the words are the keys and their definitions are the values! In both types of dictionaries the keys are unique. However, there are some differences too. For example, Python dictionaries are not ordered, while word dictionaries are usually ordered alphabetically.
If you have any questions, you can ask on Discord!
# credits: @imagidori
# heart function that has two
# parameters: day of the week and
# left or right
def heart(day, lr):
#this is the dictionary
color_day = {
"mo": R,
"tu": B,
"we": M,
"th": A,
"fr": Y,
"sa": G,
"su": O
}
c = color_day[day]
if lr == "left":
m[0][5] = c
m[0][6] = c
m[1][4] = c
m[1][7] = c
m[2][3] = c
m[3][3] = c
m[4][4] = c
m[5][5] = c
m[6][6] = c
m[7][7] = c
#right heart
if lr == "right":
m[0][1] = c
m[0][2] = c
m[1][0] = c
m[1][3] = c
m[2][4] = c
m[3][4] = c
m[4][3] = c
m[5][2] = c
m[6][1] = c
m[7][0] = c
heart("mo", "left")
#heart("mo", "right")
Monday
Tuesday
Wednesday
https://www.youtube.com/watch?v=oilxtFezCko&feature=youtu.be