Question: please modify the code to meet the requirements and expected outputs with inputs You will create a class to represent a Domino in the game
please modify the code to meet the requirements and expected outputs with inputs
You will create a class to represent a Domino in the game of Dominos.
Your Domino class must have the following attributes and methods: Attributes:
side and side to store the number of pips on each side of the domino Methods:
a constructor
an str method note most of the testing works based on this so it is important to get this done first class Domino:
# define constructor with parameters
# and initializes the instances attributes, side and side
# define a str method that returns the domino as a string in the form
# side side where both sides are formatted with
# a field width of where a side is is displayed instead
#
# DO NOT CHANGE THIS METHOD
def reprself:
DO NOT CHANGE!
Helper for allowing print and pprint to print the domino
return strself
#
# define the isdouble method that returns true if and only if both sides of the domino are equal, and false otherwise
# define the issingle method that returns true if and only if the both sides of the domino are different, and false otherwise
# define the isblank method that returns true if and only if the tile has, at least, one side blank and false otherwise
# define the matchesself other method that returns true if self matches the other domino. self matches when it's second side matches one of the sides of
# the other domino. In the case that side matches side of the other, then other must be flipped.
# However, note that we never flip self meaning that when only side is equal to one of other's sides
# we do NOT flip self
# define the flip method that flips side with side So for example a domino flipped would be
# define the weight method that returns the total weight of the domino.
# The weight is the total number of pips on a domino, unless the domino is a double blank.
# The weight of the double blank is
# define the majorsuit method that returns the bigger side. For example, the major suit of is
# define the minorsuit method that returns the smaller side. For example, the minor suit of is
# Your code to read in the value of two sides of the Domino
# and then print the domino using its str method
domino Dominos s
printdomino
printdominoisdouble
printdominoissingle
printdominoisblank
printdominoweight
printdominomajorsuit
printdominominorsuit
domino.flip
printdomino
d Dominodominoside
printdominomatchesd
d Domino domino.side
printdominomatchesd
printd
printdominomatchesDomino
Input
Expected output
:
False
True
False
False
True
False
False
Falge
False
Input
Expected output
True
Falss
True
True
True
False
False
False
False
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
