Search code examples
pythonobjectintegertypeerroriterable

"TypeError: 'float' object is not iterable" in division list


I'm trying to make a program that searches through servers and finds a server with a player in it, the problem is the servers are split in to groups, like: pages = (#servers / maxPlayers). I was able to get the number of servers through: round(playing / maxPlayers), which is working but for some reason whenever I try using this: for server in servers / round(maxPlayers): it gives me "TypeError: 'float' object is not iterable". I have gone through so many of these same questions on here and none of them have helped me. Any help will be literally appreciated no joke I have been working on trying to fix this for like 30 minutes.


Solution

  • You should loop using:

    for server in range(int(servers/round(maxPlayers))):