Answered step by step
Verified Expert Solution
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 collegesuniversities compete headtohead with one another to crown the most popular mascot. UC Irvine won in but sadly fell just a few votes short of a repeat victory in
This lab will require you to create & manipulate the namedtuples for three mascots consisting of:
mascotname
species
schoolname
numberofvotes
To do this you must:
Import the namedtuple package in Python
Construct the Mascot namedtuple with fields mascotname, species, schoolname and numberofvotes
Create mascots with the following information for their named fields:
mascotname "Peter", species "Anteater", schoolnameUC Irvine", numberofvotes
mascotname "Victor E species "Bulldog", schoolname"Fresno State", numberofvotes
mascotname "Tuffy the Titan", species "Elephant", schoolname"Cal State Fullerton", numberofvotes
Place the mascots into a list in order of creation, and print.
Mascotmascotname'Peter', species'Anteater', schoolnameUC Irvine', numberofvotes Mascotmascotname'Victor E species'Bulldog', schoolname'Fresno State', numberofvotes Mascotmascotname'Tuffy the Titan', species'Elephant', schoolname'Cal State Fullerton', numberofvotes
One of the mascots has selfreported 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:
Enter the correct vote total:
Update the namedtuple with the correct number of votes & redisplay the updated list..
Mascotmascotname'Peter', species'Anteater', schoolnameUC Irvine', numberofvotes Mascotmascotname'Victor E species'Bulldog', schoolname'Fresno State', numberofvotes Mascotmascotname'Tuffy the Titan', species'Elephant', schoolname'Cal State Fullerton', numberofvotes
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