jeudi 5 octobre 2017

How to Add a random number to a variable in python

I'm trying to generate random numbers added to text to create a new variable.

gen = random.randint(100, 1000)
usrgen = gen("usr")

"usr" is the variable, I need to get it to print as "243usr" for example.

I get this error

usrgen = gen("usr")
TypeError: 'int' object is not callable

Any help would be appriciated, thanks :)




Aucun commentaire:

Enregistrer un commentaire