input: Write a function to create a simple chatbot using Python and state diagrams. The function should define the states, initialize the current state, and manage the conversation loop based on user inputs. If the user input matches a reply in the current state, the state should transition to the corresponding next state. If the input does not match, the chatbot should prompt the user to try again. Once a terminal state is reached, the chatbot should end the conversation and print the complete conversation history.
  assert chatbot_simulation()==['Hello! How can I help you?', 'I need some advice', 'Sure, what kind of advice do you need?', 'Career advice', "It is always a good idea to research the field you are interested in and creating a plan to learn the skills that are required. Make sure to contact professionals in the field to understand their experience.", 'Goodbye!']
  assert chatbot_simulation()==['Hello! How can I help you?', 'Can you answer my questions?', 'Yes, I'll do my best! What do you want to know?', 'Where can I find good tutorials', "You can find tutorials online or join coding communities to get help from experienced coders. StackOverflow and Cod Academy are great resources.", 'Goodbye!']
  assert chatbot_simulation()==['Hello! How can I help you?', 'I need some advice', 'Sure, what kind of advice do you need?', 'Health advice', 'Focus on eating healthy and staying active. Make sure to consult a medical professional if you have any concerns.', 'Goodbye!']
  assert chatbot_simulation()==['Hello! How can I help you?', 'Invalid input', "I don't understand what you mean. Please try again.", 'I need some advice', 'Sure, what kind of advice do you need?', 'Career advice', "It is always a good idea to research the field you are interested in and creating a plan to learn the skills that are required. Make sure to contact professionals in the field to understand their experience.", 'Goodbye!']
  assert chatbot_simulation()==['Hello! How can I help you?', 'I need some advice', 'Sure, what kind of advice do you need?', 'Health advice', 'Focus on eating healthy and staying active. Make sure to consult a medical professional if you have any concerns.', 'Goodbye!']
output: def chatbot_simulation():
      states = {
          'start': {
              'message': 'Hello! How can I help you?',
              'replies': {
                  'I need some advice': 'advice',
                  'Can you answer my questions?': 'questions',
                  'Invalid input': 'invalid'
              }
          },
          'advice': {
              'message': 'Sure, what kind of advice do you need?',
              'replies': {
                  'Career advice': 'career',
                  'Health advice': 'health'
              }
          },
          'questions': {
              'message': "Yes, I'll do my best! What do you want to know?",
              'replies': {
                  'Where can I find good tutorials': 'tutorials'
              }
          },
          'invalid': {
              'message': "I don't understand what you mean. Please try again.",
              'replies': {
                  'I need some advice': 'advice'
              }
          },
          'career': {
              'message': "It is always a good idea to research the field you are interested in and creating a plan to learn the skills that are required. Make sure to contact professionals in the field to understand their experience.",
              'replies': {}
          },
          'health': {
              'message': 'Focus on eating healthy and staying active. Make sure to consult a medical professional if you have any concerns.',
              'replies': {}
          },
          'tutorials': {
              'message': "You can find tutorials online or join coding communities to get help from experienced coders. StackOverflow and Cod Academy are great resources.",
              'replies': {}
          }
      }
      
      current_state = 'start'
      conversation = []
      
      while current_state != 'end':
          conversation.append(states[current_state]['message'])
          if not states[current_state]['replies']:
              break
          user_input = input(states[current_state]['message'] + ' ')
          if user_input in states[current_state]['replies']:
              current_state = states[current_state]['replies'][user_input]
          else:
              current_state = 'invalid'
      
      conversation.append('Goodbye!')
      return conversation