So what exactly is polymorphism? Remember, a variable can normally only contain
a value of the same type as the variable. With Polymorphism, a variable contain any
value that is a subtype of the variable. Thus a Car variable can contain a Sedan,
1. Parameters: (int starting_x, int starting_y, int starting_size)
Parameters are symbolic names for the information that must be presented to
the object when it is created. The information in these symbolic names, which
is provided by the "caller" of the
An Objects' Constructor
The constructor of an object is a method that is called whenever you need a new
object. The purpose of the constructor is to fill in all the fields (or variables)
associated with an object. No object should ever be created without
1. Write a function fact(n) which computes n!.
a. Write it recursively.
b. Write it non-recursively.
2. Write a function fib(n) which computes the nth Fibonacci number.
a. Write it recursively no memorization.
b. Write it recursively with memorization.
1. Write a function backwards(n), that when passed an integer n, prints out the digits of n in
2. Redo question 1 recursively.
3. Write a function reverse(n), that when passed an integer n, returns the integer with the digits
of n in revers
1. Write a function, get_evens(x), that takes a list n of integers and returns a list having only the
even values in x.
2. Write a function sum_of_odd_cols(x), that takes a 2-dimensional list of integers and returns
the sum of the values in the odd column
1. Consider the following (unformatted) code:
if x > 3: if x <= 5: y = 1 elif x != 6:
y = 2 else:
y = 3 else: y = 4
a. Rewrite it with appropriate indentation so that it is valid Python code.
b. If y has the value 2 after executing the above program fragm
1. Write a complete Python program that does the following. (Dont use a loop, even if you know how.)
1. It asks the user to enter a positive number x.
2. The program reads the number entered by the user. If x is not less than 10, the program
1. W rite a program to ask the user for their first name, then their last name. Your
program should then print "Welcome <first> <last>!" where <first> <last> are replaced
by the names that they entered.
2. Write a program to ask the user to input two inte
1. Comments: Every Method should be fully commented including a description
of the parameters and the purpose of the method.
What does it mean to "paint" a "generic shape". It has no meaning. But a
"real shape" does need some way to