Dec-02-2018, 10:22 PM
(This post was last modified: Dec-02-2018, 10:22 PM by Gribouillis.)
Tip: when variable names contain a varying index such as in
tuple0=("","","") tuple1=("","","") tuple2=("a","b","c") tuple3=("d","e","f") tuple4=("g","h","i") tuple5=("j","k","l") tuple6=("m","n","o") tuple7=("p","q","r","s") tuple8=("t","u","v") tuple9=("w","x","y","z")use a single list variable instead
atuple = [ ("","",""), ("","",""), ("a","b","c"), ("d","e","f"), ("g","h","i"), ("j","k","l"), ("m","n","o"), ("p","q","r","s"), ("t","u","v"), ("w","x","y","z")]Then instead of
tuple7
, use atuple[7]
. It allows loops or simplifications such aslist_tuple.append(atuple[int(number)])Similarly, instead of the variables a, b, c, d, e, f, g, you could use a list to contain them all. Finally, have a look at
itertools.product()
!