Observe the following class definition and answer the question that follows :

class info:

ips=0

def _str_(self): #Function 1

return "Welcome to the Info Systems"

def _init_(Self):

self. _ Sstemdate= " "

self. SystemTime = " "

def getinput (self):

self . Systemdate = raw_input ("enter data")

self , SystemTime = raw_Input ("enter data")

Info, incrips ()

Estaiomethod # Statement 1

def incrips ():

Info, ips, "times"

I = Info ()

I. getinput ()

Print I. SystemTime

Print I. _Systemdate # Statement 2

(i). Write statement to invoke Function 1. 

(ii). On Executing the above code, Statement 2 is giving an error explain.

4 views

1 Answers

(i). print I 

(ii). The statement 2 is giving an error because _Systemdate is a private variable and hence cannot to be printed outside the class.

4 views