How do I concatenate string and an integer?

Question:

act = input("Enter name of the activity")
cellone = int(input("Enter the order number of activity"))
cell1 = "A" + cellone
worksheet.write(cell1, act)
  

I’m trying to concatenate A and cellone but I’m getting some error saying that I can’t concatenate string and an integer, is there a way to do this?

Asked By: CharizardLizard

||

Answers:

str(cellone) returns the value of cellone as a string.

call1="a"+str(cellone)
Answered By: clickbait

Remove the int in line 2 as follows:

cellone=input("Enter the order number of activity")

It takes the input as a string data type anyway

Answered By: user18511682

Just dont convert the string to int. correct that to

cellone=input("Enter the order number of activity")
Answered By: balu

You can change int to a string representation using this:

cell1="A"+str(cellone)

Alternatively, f-string formatting will also work:

cell1=f"A{cellone}"
Answered By: SultanOrazbayev