I have a class
class zero:
top = " __ "
mid = "| |"
bot = "|__|"
And I want to use a loop to call the different sections. E.g.:
def printnum(list):
chunks = ['top','mid','bot']
print section # prints "top"
print zero.top # prints " __ "
print zero.section # fails
for section in chunks:
string = ''
for x in list:
if x == '1':
string += getattr(one, section)
elif x == '2':
string += getattr(two, section)
etc....
I must be missing something pretty basic here. Can I use my loop to call the different parts of my class?
Here's a snippet of intended functionality:
>>Enter the number you would like printed: 21
__ __
__||__
__| __|