title: Acessing last list element using list comprehension
body: <p>Problem -  Creat a list with variable size and acessing last element.</p>
  
  <p>I have divided my problem in two functions.
  First function - I have done this first function using normal appending method and list comprehension;
  Second function - accessing last element</p>
  
  <pre><code>#first code
  v = []
  
  def creat_v():
    size = int(input('size  -'))
    for i in range(0,size):
      number = int(input('Number - '))
      v.append(number)
    return v
  print(creat_v())
  
  def last_element():
    return v[len(v)-1]
  print(last_element())
  
  #second code
  v = []
  
  def creat_v():
    v = [int(input('Number - ')) for i in range(0,int(input('Size - ')))]
    return v
  print(creat_v())
  
  def last_element():
    return v[len(v)-1]
  print(last_element())
  </code></pre>
  
  <p>By doing the second code ('List comprehensions') it prints the list but returns the error regarding the second function:</p>
  
  <pre><code>Traceback (most recent call last):
    File "main.py", line 11, in &lt;module&gt;
      print(last_element())
    File "main.py", line 10, in last_element
      return v[len(v)-1]
  IndexError: list index out of range
  </code></pre>