title: Unsupported operand type(s) for +: 'float' and 'list'
body: <p>I was starting with pygame recently and tried making a snake game, in which I came up with this error.</p>
  <p>here is my code!</p>
  <pre><code>import pygame
  import random
  import time
  
  pygame.init()
  
  print(&quot;SELECT LEVEL:\n&quot;
        &quot;EASY\n&quot;
        &quot;MEDIUM\n&quot;
        &quot;HARD\n&quot;
        &quot;DIFFICULT\n&quot;)
  level=input()
  if level ==&quot;easy&quot; or &quot;EASY&quot;:
      fps=35
  elif level ==&quot;medium&quot; or &quot;MEDIUM&quot;:
      fps=50
  elif level ==&quot;hard&quot; or &quot;HARD&quot;:
      fps=80
  elif level ==&quot;difficult&quot; or &quot;DIFFICULT&quot;:
      fps=110
  
  win=pygame.display.set_mode((600,600))
  pygame.display.set_caption(&quot;SNAKE GAME&quot;)
  clock=pygame.time.Clock()
  x=10
  y=10
  dim=10
  vel=5
  snake_pos=[]
  
  def snake(dim,snake_pos):
      for x in snake_pos:
          pygame.draw.rect(win, (255, 0, 0), [x[0], x[1], dim, dim])
  def snakegame():
      gameover=False
      gameend=False
  
      x1=600/2
      y1=600/2
  
      x1_change=0
      y1_change=0
  
      snakelist=[]
      length_of_snake=1
  
      foodx=round(random.randrange(0,600-dim)/10.0)*10.0
      foody=round(random.randrange(0,600-dim)/10.0)*10.0
  
  
      while not gameover:
          while gameend==True:
              score=length_of_snake-1
              score_font=pygame.font.SysFont(&quot;comimsansms&quot;,45)
              value=score_font.render(&quot;Your score is:&quot;+str(score),True,(0,0,255))
              win.blit(value,[600/3,600/5])
              pygame.display.update()
  
              for event in pygame.event.get():
                  if event.type==pygame.QUIT:
                      gameend=False
                      gameover=True
  
          #win.fill((0,0,0))
  
  
          for event in pygame.event.get():
              if event.type==pygame.QUIT:
                  gameover=True
  
              if event.type==pygame.KEYDOWN:
                  if event.key==pygame.K_LEFT:
                      x1_change=-snake_pos
                      y1_change=0
                  if event.key == pygame.K_RIGHT:
                      x1_change = snake_pos
                      y1_change = 0
                  if event.key==pygame.K_UP:
                      y1_change=-snake_pos
                      x1_change=0
                  if event.key==pygame.K_DOWN:
                      y1_change=snake_pos
                      x1_change=0
  
          if x1&gt;=600 or x1&lt;0 or y1&gt;=600 or y1&lt;0:
              gameend=True
          x1=x1+x1_change
          y1=y1+y1_change
          win.fill((0,0,0))
          pygame.draw.rect(win,(255,255,0),[foodx,foody,dim,dim])
          snake_head=[]
          snake_head.append(x1)
          snake_head.append(y1)
          snake_pos.append(snake_head)
  
          if len(snake_pos)&gt;length_of_snake:
              del snake_pos[0]
  
          for x in snake_pos[:-1]:
              if x==snake_head:
                  gameend=True
          snake(dim,snake_pos)
          pygame.display.update()
          if x1==foodx and y1==foody:
              foodx = round(random.randrange(0, 600 - dim) / 10.0) * 10.0
              foody = round(random.randrange(0, 600 - dim) / 10.0) * 10.0
              length_of_snake=length_of_snake+1
          clock.tick(fps)
      pygame.quit()
  
  
  snakegame()
  </code></pre>
  <p>After running its showing the screen ...but when I try to move it..its giving this error message.
  tried everything but nothing is working</p>
  <pre><code>Traceback (most recent call last):
    File &quot;C:/pypy/projects/snakeGame.py&quot;, line 112, in &lt;module&gt;
      snakegame()
    File &quot;C:/pypy/projects/snakeGame.py&quot;, line 87, in snakegame
      x1=x1+x1_change
  TypeError: unsupported operand type(s) for +: 'float' and 'list'
  </code></pre>
  <p>I am using pycharm anaconda 3.7, will be glad if someone can help</p>