Yes/No Question
Lesson 4 of 11 in Coddy's Quiz Generator - Python OOP Project course.
Challenge
EasyCreate class YesNoQuestion which inherits from Question and implements constructor and the methods print and check from Question class.
Constructor - should get string and boolean and save them under the fields question and answer accordingly.
print method - prints the question in the format '[?] {question} (yes/no)'
For example, if the question is 'Are you experienced programmer?', the method should print '[?] Are you experienced programmer? (yes/no)'
check method - returns True if input string is 'yes' and answer (class field) is True or if input string is 'no' and answer is False, otherwise False.
Try it yourself
from abc import ABC, abstractmethod
class Question(ABC):
@abstractmethod
def print(self):
pass
@abstractmethod
def check(self, answer):
pass