Task - 2 |class Vehicle: def _init_(self): self.x0 self.y - 0 def moveup(self): self.y+-1 def moveDown (self): self.y--1 def moveright(self): self.x+1 OUTPUT: Part 1 (0.0) (0.1) (-1, 1) (-1,0) (0.0)...


Task - 2<br>|class Vehicle:<br>def _init_(self):<br>self.x0<br>self.y - 0<br>def moveup(self):<br>self.y+-1<br>def moveDown (self):<br>self.y--1<br>def moveright(self):<br>self.x+1<br>OUTPUT:<br>Part 1<br>(0.0)<br>(0.1)<br>(-1, 1)<br>(-1,0)<br>(0.0)<br>Part 2<br>def moveleft(self):<br>self.x-1<br>(0.0)<br>(-1,-1)<br>False<br>def _str_(self):<br>return '('+str(self.x)+', +str(self.y)+')' True<br>write your code here<br>print('Part 1')<br>print( ------)<br>car - Vehicle()<br>print(car)<br>car.moveup()<br>print(car)<br>car.moveleft()<br>print(car)<br>car.moveDown()<br>print(car)<br>car.moveRight ()<br>print(car)<br>print('------')<br>print('Part 2')<br>print('------')<br>cari - Vehicle2010()<br>print(cari)<br>car1.novelowerLeft()<br>print(cari)<br>car2 - Vehicle2010()<br>car2.noveleft()<br>print(carl.equals(car2))<br>car2.moveDown ()<br>print(carl.equals(car2))<br>

Extracted text: Task - 2 |class Vehicle: def _init_(self): self.x0 self.y - 0 def moveup(self): self.y+-1 def moveDown (self): self.y--1 def moveright(self): self.x+1 OUTPUT: Part 1 (0.0) (0.1) (-1, 1) (-1,0) (0.0) Part 2 def moveleft(self): self.x-1 (0.0) (-1,-1) False def _str_(self): return '('+str(self.x)+', +str(self.y)+')' True write your code here print('Part 1') print( ------) car - Vehicle() print(car) car.moveup() print(car) car.moveleft() print(car) car.moveDown() print(car) car.moveRight () print(car) print('------') print('Part 2') print('------') cari - Vehicle2010() print(cari) car1.novelowerLeft() print(cari) car2 - Vehicle2010() car2.noveleft() print(carl.equals(car2)) car2.moveDown () print(carl.equals(car2))

Jun 03, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here