I'm looking to use a for loop to create multiple variables, named on the iteration (i), and assign each one a unique int.
Xpoly = int(input("How many terms are in the equation?"))
terms={}
for i in range(0, Xpoly):
terms["Term{0}".format(i)]="PH"
VarsN = int(len(terms))
for i in range(VarsN):
v = str(i)
Temp = "T" + v
Var = int(input("Enter the coefficient for variable"))
Temp = int(Var)
As you see at the end I got lost. Ideally I'm looking for an output where
T0 = #
T1 = #
T... = #
T(Xpoly) = #
Any Suggestions?
T0,T1. CodeTemp = "T" + vdoesn't create variable with nameT0,T1but only text"T0","T1"which you can use in dictionaryterms[Temp] = Var- furaslower_casenames for variables and functions -vars_n,temp,var- it makes code more readable because we useCamelCasenames only for classes. - furasforloop - withterms["Term{0}".format(i)] = var- furas