TORONTO KIDS COMPUTER CLUB | Aurora Saturday 14:30 Python Homework 11.16.
16738

# Aurora Saturday 14:30 Python Homework 11.16.

## 20 Nov Aurora Saturday 14:30 Python Homework 11.16.

Question 1：

Create a Tank object which have the attributes of:

• name
• direction(up/down/left/right)
• x position and
• y position

The object also have a method:

• move (direction, steps)

Using __init__ to Initial the tank to make sure it start from x position of 0 and y position of 0

Use print(tank object) to print out the tank’s current x and y position after each move. (need to overwrite __str__(self) method

Question 2：

Create an OunceConversion object to convert any number of fluid ounces to the equivalent number of gallons, quarts, pints, and gills. (There are 128 fluid ounces in a gallon. There are 32 fluid ounces in a quart. There are 16 fluid ounces in a pint. There are 4 fluid ounces in a gill.)

• Get the number of fluid ounces as an integer from the user; make sure to use a descriptive prompt so the user knows what to enter, e.g.:

Sample input: