Creating Custom French-to-English Dictionary in Python


dictFrench = {
      "je": "I",
      "chat": "cat",
      "chien": "dog",
      "cheval": "horse",
      "femme": "woman",
      "fille": "girl",
      "homme": "man",
      "avec": "with",
      "elle": "she",
      "garcon": "boy",
      "bonjour": "Good Morning!",
      "salut": "hi"
}

print("\nWelcome to the cute little French-to-English Dictionary!")
print("\nThis dictionary contains the following French words.")

for word in dictFrench.keys():
      print(word)
while True:
      french_word = input("\nInput any French word to know its english meaning: ")
      if french_word in dictFrench.keys():
            print(f"\'{french_word}\' is French for \'{dictFrench[french_word]}\'.")
      elif french_word == "":
            print("Sorry! You have not entered any word.")
      else:
            print("Sorry this word is not in our dictionary.")
   

    

Comments

Popular posts from this blog

Quotation marks to wrap an element in HTML

What is the difference between iostream and iostream.h in cpp?

The Basic Structure of a Full-Stack Web App