24 Jun Aurora Saturday 16:30 Python Homework 20.06.20.
Posted at 14:39h in archives 0 Comments
Create a Tank class which have the attributes of:
- direction(use ‘up’, ‘down’, ‘left’ or ‘right’)
- x position and
- y position
The class also have the following method:
- move (self, direction, steps)
- Using __init__() to Initial the tank to make sure it start from x position of 0, y position of 0 and facing up
- __str__(self) method
You need write main program to create tank object from Tank class, you need to use the method of move and use print(tank object) to print out the tank’s current x, y position and its direction after each move.
Sorry, the comment form is closed at this time.