I need help with a small part in my code, I'm a bit rusty.
It's hard to explain here but basically I need to switch between the variables, depending on their race etc., as I read through each of the records
Basically I want to rename variables as I go as there are a lot of variables for different categories, age, occupation, country, race etc..
So something like:
#(NewRecord[3] will have details of race)
if NewRecord[3] = "black"
var1 += blackcounter
else if NewRecord[3] = "white"
var1 += whitecounter`
could be:
for NewRecord[3] = "%s"
var1 += "%s"counter
??? How do I do this?
Aditional info...:
The programme I'm trying to make is an income predictor for people over and under 50k a year.
whiteCountUnder50
asianCountUnder50
indianCountUnder50
otherCountUnder50
blackCountUnder50
whiteCountOver50
asianCountOver50
indianCountOver50
otherCountOver50
blackCountOver50
#if white
overchance += (whiteCountOver50 / TotalPeopleOver)
underchance += (whiteCountUnder50 / TotalPeopleUnder)
print ("overchance: ", overchance)
print ("underchance: ", underchance)
#if black
overchance += (blackCountOver50 / TotalPeopleOver)
overchance += (blackCountUnder50 / TotalPeopleUnder)
print ("overchance: ", overchance)
print ("underchance: ", underchance)
#if asian
....
#if indian
....
etc...