As title says, what's the pythonic way to write the following code?
if x == 1:
myvar = "a string"
elif x == 2:
myvar = "another string"
elif x == 3:
myvar = "yet another string"
else:
raise Exception("arg x must be 1, 2 or 3")
It seems a bit clumsy to do the above, and for longer examples, much more time consuming and messy.