Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Instructor note: Skills Reinforced: - Importing a module - Namedtuple creation - Nested Structure Access - Built-In Function: _replace() - Mutability/In-place modification (2020 Tokyodachi Tournament)

image text in transcribedimage text in transcribedimage text in transcribed

Instructor note: "Skills Reinforced: - Importing a module - Namedtuple creation - Nested Structure Access - Built-In Function: _replace() - Mutability/In-place modification" (2020 Tokyodachi Tournament) Tokyodachi Mascot Mania is a tournament where mascots from US colleges/universities compete head-to-head with one another to crown the most popular mascot. UC Irvine won in 2020 , but sadly fell just a few votes short of a repeat victory in 2021. This lab will require you to create \& manipulate the namedtuples for three mascots consisting of: - mascot_name - species - school_name - number_of_votes To do this you must: 1. Import the namedtuple package in Python 2. Construct the Mascot namedtuple with fields mascot_name, species, school_name and number_of_votes 3. Create 3 mascots with the following information for their named fields: mascot_name= "Peter", species = "Anteater", school_name="UC Irvine", number_of_votes=137988 mascot_name= "Victor E.", species = "Bulldog", school_name="Fresno state", number_of_votes=118302 mascot_name= "Tuffy the Titan", species = "Elephant", school_name="Cal State Fullerton", number_of_votes=94413 5. Place the mascots into a list in order of creation, and print. [Mascot (mascot_name='Peter', species='Anteater', school_name='UC Irvine', number_of_votes=137988), Mascot (mascot_name='Victor E.', species='Bulldog', school_name='Fresno State', number_of_votes=118302), Mascot(mascot_name='Tuffy the Titan', species='Elephant', school_name='Cal State Fullerton', number_of_votes=94413) ] 6. One of the mascots has self-reported an incorrect number of votes. Enter the index of the mascot with the incorrect votes, and the updated vote tally. Enter the mascot to update: 2 Enter the correct vote total: 95000 7. Update the namedtuple with the correct number of votes \& re-display the updated list.. [Mascot (mascot_name='Peter', species='Anteater', school_name='UC Irvine', number_of_votes=137988), Mascot (mascot_name='Victor E.', species='Bulldog', school_name='Fresno State', number_of_votes=118302), Mascot(mascot_name='Tuffy the Titan', species='Elephant', school_name='Cal State Fullerton', number_of_votes=95000) ]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions