01
02
03
04
05
06
07
08
09
10
|
def myprint(a):
for i,x in enumerate(a):
print(i, x)
def main():
lst = [11,21,31]
myprint(lst)
if __name__ == "__main__":
main()
|
|
01
02
03
04
05
06
07
08
09
10
11
12
13
14
|
package algs11;
import stdlib.*;
public class Hello {
public static void myPrint (double[] a) {
for (int i=0; i<a.length; i++) {
double x = a[i];
StdOut.println(i + " " + x);
}
}
public static void main (String[] args) {
double[] lst = { 11, 21, 31 };
myPrint (lst);
}
}
|
|