'TypeError: sequence item 0: expected str instance, int found python

I am beginner and i don't know much about python. While i wanted to code a program that can generate flexible codes and wanted to add random numbers in it, i get this errror. Could you please help me?? TypeError: sequence item 0: expected str instance, int found

code:

import random
from random import choice
from string import ascii_uppercase 
numbers = (0,9)

codeamt = int(input('how many?: '))
codelnt = int(input('how many in one block?: '))
codeblockamt = int(input('how many blocks: '))

for i in range (codelnt):
    code = ''.join(choice(ascii_uppercase and  numbers) for i in range (codelnt)).join(choice(ascii_uppercase and numbers) for i in range(codelnt))

for i in range (codeamt):
    print('-'.join(''.join(choice(ascii_uppercase and numbers) for k in range (codelnt)) for j in range(codeblockamt)))```


Solution 1:[1]

It looks as though you're expecting (0,9) to give you all the numbers between 0-9 which isn't the case, it just creates a tuple. range(0,9) might be closer but even that won't help when you just use them for string purposes.

Just make a string with the desired digits and then concatenate your strings correctly

from string import digits
numbers = digits
   or 
numbers = "0123456789"


choice(ascii_uppercase + numbers)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Sayse