DNPotapov / Codewars-katas-

0 stars 0 forks source link

The U-n-KNOWN but known variables: Multiplication (6 kyu) #29

Open DNPotapov opened 1 year ago

DNPotapov commented 1 year ago
def the_var(the_variables):
    bykvi = {"a":13,"b":12,"c":11,"d":10,"e":9,"f":8,
             "g":7,"h":6,"i":5,"j":4,"k":3,"l":2,"m":1,
             "n":0,"o":1,"p":2,"q":3,"r":4,"s":5,"t":6,
             "u":7,"v":8,"w":9,"x":10,"y":11,"z":12}
    return bykvi[the_variables[0]] * bykvi[the_variables[2]]
DNPotapov commented 1 year ago

This kata is definitely harder than the first one. See the last one here: http://www.codewars.com/kata/the-unknown-but-known-variables-addition

This one is a programming problem as well as a puzzle. And this is one of those annoying puzzles that is going to seem impossible, as the answer is not like a riddle, but something random some jerk over the internet came up with. But I have confidence you will solve it.

There will be a string input in this format: 'a*b'

2 lower-case letters (a-z) seperated by a '*'

Return the product of the two variables. The product will always be a positive integer or 0.

There is one correct answer for a pair of variables.

I know the answers, it is your task to find out.

Once you crack the code for a couple of the pairs, you should have the answer for the rest.

It is like when you were in school doing math and you saw "12 = c*b" and you needed to find out what c and b were.

However you don't have a 12. You have an UnKNOWN there as well. Example:

X = a*b.

You don't know what X is, and you don't know what b is or a, but it is a puzzle and you will find out.

As part of this puzzle, there is two hints or clues on solving this. I won't tell you what the other one is. But the first is: The key is in the title.

Given the input as a string - Return the product of the two variables as int.

DNPotapov commented 1 year ago

https://www.codewars.com/kata/571a8920b29485b065000582