Question and test cases given below (see pic): Code for reference: class Document: #TO DO: define the constructor method, __init__ and then initialize values #def __init__(___, ___): # initilialize values here #TO DO: define the method add_words #def add_words(___, ___): #TO DO: define the method submit #def submit(___): #TO DO: define the method get_grade #def get_grade(___): def __str__(self): #TO DO: Fill in the blanks document_info = f"This Document instance has _ instance attributes.\n" document_info += f"The class used to create this object has _ methods and _ class attribute.\n" document_info += f"This Document instance has the following stats.\n" #TO DO: Complete document_info by adding more lines below return document_info if __name__ == "__main__": while(True): command = input() if command == 'exit': break exec(command) print(essay)
Question and test cases given below (see pic):
Code for reference:
class Document:
#TO DO: define the constructor method, __init__ and then initialize values
#def __init__(___, ___):
# initilialize values here
#TO DO: define the method add_words
#def add_words(___, ___):
#TO DO: define the method submit
#def submit(___):
#TO DO: define the method get_grade
#def get_grade(___):
def __str__(self):
#TO DO: Fill in the blanks
document_info = f"This Document instance has _ instance attributes.\n"
document_info += f"The class used to create this object has _ methods and _ class attribute.\n"
document_info += f"This Document instance has the following stats.\n"
#TO DO: Complete document_info by adding more lines below
return document_info
if __name__ == "__main__":
while(True):
command = input()
if command == 'exit':
break
exec(command)
print(essay)
Step by step
Solved in 3 steps with 1 images