Answered step by step
Verified Expert Solution
Question
1 Approved Answer
# Question 1 : # Create a function, called student _ id _ numbers, that takes a list of student names # and generates an
# Question :
# Create a function, called studentidnumbers, that takes a list of student names
# and generates an automatic student id number. The function must be able to handle
# collisions using dictionaries. A collision will happen when students have the same
# last name. The function must return the dictionary or dictionaries containing the
# students and their student id numbers.
# Note: using defaultdict might be helpful but not required. Having some good music
# while you code this might be helpful but also not required.
# You will also need to write a second function, called retrieve studentnumber that
# will take a student's name and will return their student id number. This function
# will need to handle misspelled names.
#Question :
# In France there is a child's marching song called Un Kilometre a Pied" which
# translates to One Kilometer On Foot. The lyrics are:
# One kilometer on foot wears out, wears out,
# One kilometer on foot wears out your shoes for good.
# Two kilometers on foot wears out, wears out,
# Two kilometers on foot wears out your shoes for good.
#
# The lyrics repeat to infinity or rather until the kids get tired of singing
# Create a function, called unkilometreapied, which takes no parameters and prints
# the lyrics of the song to the console. The function must make use of a generator to
# write the lyrics of the song until the user decides to stop. The generator you use must
# be able to produce a value that increses to infinity. You must make sure that your code
# doesn't get caught in an infinite loop that is difficult to exit, I recommend having
# the necessary logic to allow the user to exit whenever they get tired of the song. #Question :
# Create a class, called Tent, that contains the following attributes in the order given:
# numoccupants int
# material str
# setuptime int number of minutes
# sqft float
# vestibule bool True if tent has a vestibule
# weight float
# structurepoles bool True if tent has structural poles. Should have a default value of True
# seasons int or Should have a default value of
#The class should also have the following methods:
# str
# repr
# ltthis should use the numoccupants and sqft attributes to determine if one tent is
# less than another tent
# isbetter a tent is considered better if and only if its weight and setuptime is less than
# another tent whilst having equal or better season rating
#Question :
# We wish to compare and store data on various types of shelters for when we go backpacking.
# Create a class, called Hammock, that contains the following attributes in the order given:
# numoccupants int
# material str
# setuptime int number of minutes
# weight float
# length int length of hammock in feet. Should have a default value of
# seasons int or Should have a default value of
#The class should also have the following methods:
# str
# repr
# ltthis should use the weight and setuptime attributes to determine if one hammock is
# less than another hammock
# isbetter a tent is considered better if and only if its weight and setuptime is less than
# another tent whilst having equal or better season rating
#Question :
# Create a class, called Tarp, that contains the following attributes in the order given:
# numoccupants int
# material str
# setuptime int number of minutes
# sqft float
# weight float
# seasons int or Should have a default value of
#The class should also have the following methods:
# str
# repr
# ltthis should use the numoccupants and sqft attributes to determine if one tent is
# less than another tent # isbetter a tent is considered better if and only if its weight and setuptime is less than
# another tent whilst having equal or better season rating
#Question :
# There is lots of repeated code above, let's create a parent class for Tent, Hammock and Tarp
# called Shelter. The Shelter class should have a constructor that takes over all of the
# attributes that are common for Tent, Hammock and Tarp. The Shelter class should also include
# the isbetter method. You will also need to create a new method called totalsleepingspots
# which will add up the total number of sleeping spots available from a nondetermined number
# of Shelters being passed into the method.
# Rewrite the Tent, Hammock and Tarp classes taking into account the changes brought on by using
# the Shelter parent class.
Step 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