Advertisement
Guest User

Untitled

a guest
Feb 28th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. part = {{a, b}, {c, d}, {e, f}, {g, h}}
  2. lenpart=Length[part];
  3.  
  4. Do[Which[
  5. ipart==1,
  6. Print[part[[ipart]]],
  7. ipart!=1 && ipart!=lenpart,
  8. Print[part[[ipart]]],
  9. ipart==lenpart,
  10. Print[part[[ipart]]]
  11. ],{ipart,1,lenpart}];
  12.  
  13. Do[Which[
  14. ipart==First[part],
  15. Print[ipart],
  16. ipart!=First[part] && ipart!=Last[part],
  17. Print[ipart],
  18. ipart==Last[part],
  19. Print[ipart]
  20. ],{ipart,part}];
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement