CSC 123 Python Lab. This lab is due 12/17 0. Warm up: Write and run Euclid's algorithm in Python: (define (gcd a b) (if (= a 0) b (gcd (remainder b a) a))) 1. Consider the following Python routine: def f(n) ax = 1 while n>0: ax = ax*n n=n-1 return ax It looks like ax was never declared, just used. Does that mean that ax is a global variable? Find out the scope of ax. 2. "Call by reference" refers to a style of parameter passing that passes the memory address of a variable as opposed to passing its value. In C++, a function such as void f(int &x) { x++; } uses call by reference. That is: int a=2; f(a); cout << a; // will print 3 However, don't confuse this with passing a pointer: void f(int *x), for that's still "call by value", except the value is a pointer. In Java, primitive data such as ints and doubles are passed by value, and all objects, including strings and arrays, are passed by reference (unless the object implements the interface Serializable, which is used to pass objects to distributed processes). By default, Perl uses pass by reference, which is why you'll often see the first line of Perl subroutines do: my $x = $_[0]; # or my $x = shift; which forces call-by-value by specifically declaring a lexically scoped local variable. You are to devise an experiment to determine if Python uses call-by-value or call-by-reference, and if both are used, what are the circumstances that will cause it to use one or the other method. 3. Similarly, devise an experiment to determine if Python uses applicative or normal order evalution - that is, when a procedure is passed a compound expression, does it use call by value or call by name (remember the example with division by zero?) # Be sure to answer these questions in english, included as comments to # the revelvant code fragements.