Hi Jasmine, you can verify an error message on a webpage using getText() method:
driver = webdriver.Firefox()
driver.implicitly_wait(2)
driver.maximize_window()
driver.get("https://www.amazon.in/")
err_msg = driver.find_element_by_id('a-alert-content').text
assert err_msg = 'Enter your email or mobile phone number'
driver.quit()