input: 
  def chatbot_with_state_machine():
      """ Create a simple chatbot using Python and state diagrams. The chatbot follows predefined states and transitions according to the user's input. 
      Each state has a message to display and possible replies that lead to the next state. The conversation ends when a state without replies is reached.
      Example:
      >>> chatbot_with_state_machine()
      'Hello! How can I help you?'
      >> 'Can you answer my questions?'
      'Yes, I'll do my best! What do you want to know?'
      >> 'Why is coding so hard'
      'Coding can be challenging, especially at first. Just remember that with practice, patience and problem solving skills you can overcome the obstacles.'
      Goodbye!
      """
  
output:     state = "start"
      states = {
          "start": {
              "message": "Hello! How can I help you?",
              "replies": {
                  "Can you answer my questions?": "answer_questions"
              }
          },
          "answer_questions": {
              "message": "Yes, I'll do my best! What do you want to know?",
              "replies": {
                  "Why is coding so hard": "coding_hard"
              }
          },
          "coding_hard": {
              "message": "Coding can be challenging, especially at first. Just remember that with practice, patience and problem solving skills you can overcome the obstacles.",
              "replies": {}
          }
      }
  
      while state in states:
          print(states[state]["message"])
          if not states[state]["replies"]:
              break
          user_input = input(">> ")
          state = states[state]["replies"].get(user_input, state)
  
      print("Goodbye!")