<human>:  Write me a Python code to replace strings with dictionary key values.
<bot>: Here is a Python code to replace strings with dictionary key values

import random

def replace_string_by_key_value(string, dictionary):
  """
  Replace strings by dictionary key values.
  """
  for key, value in list(dictionary.items()):
    string = string.replace(key, value)
  return string

# Enter the string
string = "rose"

# Enter the dictionary
dictionary = {"rose": "bird", "bird": "submarine"}

# Calling the function
print((replace_string_by_key_value(string, dictionary)))

#Example Output
# submarine

#Remember to inspect code for bugs.