T
T
Timebird2016-02-20 17:00:15
Python
Timebird, 2016-02-20 17:00:15

How to select N elements of an array?

There are two given arrays - one has m elements, the other has n. How to display the first m elements in both arrays?
m is less than n.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dimonchik, 2016-02-20
@Timebird

https://habrahabr.ru/post/89456/

O
Oscar Django, 2016-02-21
@winordie

Adding sugar to @Snusmumrick97's variant

for z in zip(m, n):
  print(*z)

V
Viktor Paperno, 2016-02-21
@AviPaperno

If you do not want to deal with elementary slices.

## len(Array1) = m 
## len(Array2) = n
for i in range(len(Array1)):
     print(Array1[i],Array2[i])

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question