get first 10 items of array javascript
const list = ['apple', 'banana', 'orange', 'strawberry']
const size = 3
const items = list.slice(0, size) // res: ['apple', 'banana', 'orange']
get first 10 items of array javascript
const list = ['apple', 'banana', 'orange', 'strawberry']
const size = 3
const items = list.slice(0, size) // res: ['apple', 'banana', 'orange']
python show only 1st element of nested lists
myList = [[1,2,3],[4,5,6],[7,8,9]]
#Quick answer
print([ele[0] for ele in myList]) #Prints [1, 4, 7]
#Other variations
print([[ele[0]] for ele in myList]) #Prints [[1], [4], [7]]
print([[ele[0] for ele in myList]]) #Prints [[1, 4, 7]]
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us