Question
Python: Write a class FootCovering of type object. There are five functions in this class and one variable. The one variable is a list called
Python:
Write a class FootCovering of type object. There are five functions in this class and one variable. The one variable is a list called collection, The five functions are:
__init__ which initializes a collection list variable.
addShoes() which adds shoes to collection
__iter__() starting at the last shoes added to collection
__next__() which moves the index from the last set of shoes added to the first set
shoeShoes() prints collection which uses iter and next to print the shoes in reverse order of being
added to the collection list
Write a class Shoe of type FootCovering. There are three functions in this class and four variables.
The four variables are:
material
size
close (type of closing)
name
The three functions are:
__init__ which initializes material, size, close and name for each shoe
__repr__ which returns shoe information as shown in the example
__str__ which prints shoe information as shown in the example
>fc-FootCovering ) >>>-Shoe () >s2-Shoe ('leather',8, slipon, 'Armani') >>>print (s) No name is a Tie shoe size 7 made of leather >>> print (s2) Armani is a slipon shoe size 8 made of leather Shoe (No name, 7, leather, Tie) Shoe (Armani, 8, leather, slipon) >>> fc.addShoes (s) >>> c.addShoes (s2) >fc.collection Shoe (No name, 7, leather, Tie),Shoe(Armani, 8, leather, slipon) >>> fc.showShoes () Armani is a slipon shoe size 8 made of leather No name is a Tie shoe size 7 made of leatherStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started