0
how to define unusual inputs?
i want to make it so when my code sees !=26 @=27 #=28 *=29 (=30 )=31 -=32 ==33 +=34 ,=35 .=36 ?=37 it will treat them like variables
6 Antworten
+ 4
You can't do that, because there are rules for how variables can be made up and how not.
What you can do:
Create a dictionary and use them as pseudo variables.
d = {}
d['*'] = 42
d['<'] = 9
etc.
+ 3
What I mean is:
Instead of variable names, you access string keys in a dictionary.
Since strings can be anything, you're not limited like you would be with variables.
+ 2
Do you mean you want to assign to symbols?
Like instead of...
x = 42
... you'd for example write...
< = 42
?
+ 1
Make a dict like this dict = { "1":"one"}
0
exactly
0
what's the difference between variables and pseudo variables?