Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

how to reduse the size of a list in python

# Reduce size of list by 2 elements.
values = values[:-2]
print(values)
[10, 20, 30, 40, 50]
[10, 20, 30]
Comment

reduce size of list

values = [1, 2, 3, 4, 5, 6, 7, 8]
print(values)


#reduce the size of this list by 2
values = values[:-2]
print(values) 
Comment

PREVIOUS NEXT
Code Example
Python :: slice all elements from list 
Python :: python convert docx to pdf linux 
Python :: python how to tell if class is initialized 
Python :: find element by partial link text selenium python 
Python :: sum function in python 
Python :: pylance not reading django 
Python :: generate natural numbers python 
Python :: increase tkinter window resolution 
Python :: python file operation 
Python :: python Access both key and value using items() 
Python :: how to filter even or odd model id in django 
Python :: python array to text 
Python :: Django forms I cannot save picture file 
Python :: preventing players to make entry in the same block in a python tic tac toe game 
Python :: is : and :: the same in python slice 
Python :: How did you determine the chromosome numbers and how does that relate to heredity? 
Python :: draw networkx graph using plt.pause 
Python :: rotate an image python keras 
Python :: wxPython wx.Window Connect example 
Python :: gcp jupyter use python variables in magic bigquery 
Python :: tf.data.Dataset select files with labels filter 
Python :: Implement a function word_list() that reads the 5_letter_words.txt file and returns a list of the words in the file. 
Python :: How to import modules in Python? 
Python :: Python Decorating Functions with Parameters 
Python :: how to use query in ms access with python 
Python :: PyQgis Spatial join y attribute 
Python :: queue data structure in python 
Python :: telegram bot python 
Python :: iterate over k values and plot the inertia values for each k 
Python :: graph node structure 
ADD CONTENT
Topic
Content
Source link
Name
2+5 =