I have a problem in Python.
How can I increment by one fully automatically the -“number” present in this if statement?
An example to understand me. I have this situation
def name1:
if (dictionary[class.methodclass()][constant - 1] == dictionary[class.methodclass()][constant - 2] == dictionary[class.methodclass()][constant - 3] == ldictionary[class.methodclass()][constant - 4] == dictionary[class.methodclass()][constant - 5]):
blablabla
def name2:
if (dictionary[class.methodclass()][constant - 1] == dictionary[class.methodclass()][constant - 2] == dictionary[class.methodclass()][constant - 3] == ldictionary[class.methodclass()][constant - 4]):
blabla
def name3:
if (dictionary[class.methodclass()][constant - 1] == dictionary[class.methodclass()][constant - 2] == dictionary[class.methodclass()][constant - 3]):
blabla
I repeat the same code, so how to avoid this?
Thank you
Edit: I have a normal dictonary like
dictonary = {"Element": ["Key1", "Key2"]}
I wanna have a cycle that confirm me to work with “Key1” == “Key2” case.
This is a way: