Whenever I run my code an error comes which states "TypeError: can only concatenate str (not "int") to str" this comes in the output = output + text.yellow + number
line. I understand thati can't add an integer with a string and for that I have also changed its type just before the line but it doesn't seem to work and I cant understand what the error is and how to solve it, hep would be really appreciated
My code is as below:
Info:
The text.yellow
is a class attribute which just changes the text to yellow color.
available_numbers and choosen_numbers is a list
def print_board():
number = 1
output = ""
while number < 91:
if number in available_numbers:
str(number)
output = output + text.yellow + number
int(number)
elif number in choosen_numbers:
str(number)
output = output + text.green + number
int(number)
number += 1
print(output)