title: How do i convert an integer to an index in an "if" function?
body: <p>My first question on this forum and im completely new to programming, so apologies if i do something wrong.</p>
  
  <p>So im trying to program something to do a collatz sequense on a number i put in. To do that i have to check if the number i put in is even or odd. The easy fix would be to use the built in % 2 function but i want to do it "dirty" to learn better. </p>
  
  <p>So my plan was to check if the last number in said input number is in the list (0, 2, 4, 6, 8) since an even number ends on those and is odd otherwise. Problem is how to check the very last index in the number to see if its in that list. I tried the following code</p>
  
  <pre><code>def Collatz(input_number):
      input_number_num = int(input_number)
      lenght = len(input_number_num)
      position = lenght - 1
      if [position] in input_number_num is in (0, 2, 4, 6, 8)
          return (input_number_num / 2)
      else:
          return (input_number_num * 3 + 1)
  </code></pre>
  
  <p>This gives me a syntax error, im guessing since it reads [lenght] as an tuple rather than the index.</p>