'Having State names as names instead of numbers Python

I'm trying to have an if statement condition based on state value being equal to a certain value (0,1,2,3 etc.) Is there away to have the condition be with names instead of numbers?

For example:

State=0
Homeposition =0
Scan_Function=1
if State == str(Homeposition):
  # Do something

Is there anyway to have it look cleaner? (instead of using strings)



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source