Message Boards Message Boards

0
|
2023 Views
|
1 Reply
|
2 Total Likes
View groups...
Share
Share this post:

Use an alternative solution to a list manipulation example?

Posted 5 years ago

Is there any way to write a code that has a function include Block[ ] and Do[ ] loop instead of my code?

(* m = Maximum members of "list" *)
list = {{12, 9, 10, 5}, {3, 7, 18, 6}, {1, 2, 3, 3},
   {4, 5, 6, 2}, {1, 13, 1, 1}};
m = {};
Do[
  AppendTo[m, Max[list[[All, i]]]];
  , {i, 1, Length[list[[1]]]}];
m (* {12,13,18,6} *)
POSTED BY: Nagon Stewart

Do you mean this?

Max /@ list
POSTED BY: Henrik Schachner
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract