Misha Eide Misha Eide - 28 days ago 6
Python Question

How do I count up in python with a Url

I'm not really sure how to explain what I am asking.

So what I have written is

count = 1
while count <= 100:
print("https://api.roblox.com/Users/", count)
count += 1


The goal is to print down https://api.roblox.com/Users/(count)

But what it ends up printing is ('https://api.roblox.com/Users/', (count))

Answer

You want to create a https://api.roblox.com/Users/(count) string. The way to do it is:

 "https://api.roblox.com/Users/" + str(count)

Your previous code creates a tuple containing a string and an int, which is what is printed:

>>> count = 15
>>> print("https://api.roblox.com/Users/", count)
('https://api.roblox.com/Users/', 15)

But if you concatenate the strings, it does what you want:

>>> count = 15
>>> print("https://api.roblox.com/Users/" + str(count))
"https://api.roblox.com/Users/15"