B01E – Computer Sir Ki Class

Login


Lost your password?

Don't have an account ?
Register (It's FREE) ×
  

Login
[lwa]



Exam Questions-CBSE12A-2018-B01E #PYTHON#6105    siteicon   siteicon  

Problem Statement - B01E

Find and write the output of the following python code:

class GRAPH:
    def __init__(self,A=50,B=100):
        self.P1=A
        self.P2=B
    def Up(self,B):
        self.P2 = self.P2 - B
    def Down(self,B):
        self.P2 = self.P2 + 2*B
    def Left(self,A):
        self.P1 = self.P1 - A
    def Right(self,A):
        self.P1 = self.P1 + 2*A
    def Target(self):
        print "(",self.P1.":",self.P2,")"
G1=GRAPH(200,150)
G2=GRAPH()
G3=GRAPH(100)
G1.Left(10)
G2.Up(25)
G3.Down(75)
G1.Up(30)
G3.Right(15)
G1.Target()
G2.Target()
G3.Target()

Solution

TC++ #6105


Share

CSKC| Created: 9-Jan-2019 | Updated: 9-Jan-2019|CBSE12A-2018









Back