input: Write a function to generate a histogram using the provided data in Python. The function should plot the histogram with specified bins and labels for the axes and title. If the data is empty, the function should print a message indicating that the data is empty.
  
  
  import matplotlib.pyplot as plt
  
  def generate_histogram(data):
      if not data:
          print("Data is empty.")
          return
      
      # plotting the histogram 
      plt.hist(data, bins = [0, 20, 40, 60, 80, 100, 120, 140, 160], edgecolor = 'black') 
      
      # x-axis label 
      plt.xlabel('Range of values') 
      # y-axis label 
      plt.ylabel('Number of Occurrences') 
      # plot title 
      plt.title('Histogram of data') 
      
      # function to show the plot 
      plt.show()
  
  # Test cases
  generate_histogram([3, 5, 7, 2, 8, 10, 11, 65, 72, 81, 99, 100, 150])  # Should generate a histogram
  generate_histogram([])  # Should print "Data is empty."
  
output: def generate_histogram(data):
      if not data:
          print("Data is empty.")
          return
      
      plt.hist(data, bins=[0, 20, 40, 60, 80, 100, 120, 140, 160], edgecolor='black')
      plt.xlabel('Range of values')
      plt.ylabel('Number of Occurrences')
      plt.title('Histogram of data')
      plt.show()