diff --git a/README.md b/README.md index 77cf77b4..9bd45c28 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ We have created starter projects in Java, Scala, and Python that you can use to - [Scala Project](scala/README.md) - [Python Project](python/README.md) -Note: We will be coding in Scala for the Hours with Experts course but for this challenge you can choose any language you like. +Note: We will be coding in Python for the Hours with Experts course and strongly recommend you submit your code in python, but you are welcome to choose any language you would like and we'll take that into account. #### Important When you are ready to start working on your solution, create a new branch called - yournameChallengeThree - ex) nickraffertyChallengeThree diff --git a/github/funfacts/Spring2022/Kavitha/funfact.txt b/github/funfacts/Spring2022/Kavitha/funfact.txt new file mode 100644 index 00000000..87377dec --- /dev/null +++ b/github/funfacts/Spring2022/Kavitha/funfact.txt @@ -0,0 +1,2 @@ +Kavitha +Not a workout freak but now going for boxing classes \ No newline at end of file diff --git a/python/secret_recipe_decoder.py b/python/secret_recipe_decoder.py index 813f2f7a..2193e381 100755 --- a/python/secret_recipe_decoder.py +++ b/python/secret_recipe_decoder.py @@ -52,20 +52,28 @@ def __init__(self, amount, description) -> None: def decode_string(str): - """Given a string named str, use the Caesar encoding above to return the decoded string.""" - # TODO: implement me - return '1 cup' + Return_String = "" + + for Tmp_char in str: + if Tmp_char in ENCODING: + Return_String = Return_String + ENCODING.values() + + return Return_String + def decode_ingredient(line): - """Given an ingredient, decode the amount and description, and return a new Ingredient""" - # TODO: implement me - return Ingredient("1 cup", "butter") + decoded_line=() + split_line=line.split('#') + for word in split_line: + decoded_line = decoded_line + ( decode_string(word),) -def main(): - """A program that decodes a secret recipe""" - # TODO: implement me + return decoded_line -if __name__ == "__main__": - main() + + +def main(): + with open('secret_recipe.txt', 'r') as Encoded_Recipe: + for line in Encoded_Recipe: + decode_ingredient (line)