Answer the question
In order to leave comments, you need to log in
What does this loop look like in Python?
Here is a PHP example:
foreach( $squads as $squadNumber => $squadPupils )
{
$first = $squadPupils[ 0 ];
$last = $squadPupils[ count( $squadPupils ) - 1 ]; }
Squads is an array (two dimensional) and squadNumber is the key of the array.
The "for key in array" loop doesn't work. Thank you in advance!
Answer the question
In order to leave comments, you need to log in
for squadPupils in squads:
first = squadPupils[0]
last =squadPupils[len(squadPupils)-1]
b = int(len(squadPupils)-1)
last =squadPupils[b]
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question