Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

ascots from US colleges / universities compete head - to - head with one another to crown the most popular mascot. UC Irvine won in

ascots 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:
Import the namedtuple package in Python
Construct the Mascot namedtuple with fields mascot_name, species, school_name and number_of_votes
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
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)]
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
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 to Expert-Tailored 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

Recommended Textbook for

More Books

Students also viewed these Databases questions