bryan12376
01.11.2019 •
Engineering
Write a python program to apply this:
write a program that simulates a poll for voting for contestants of america's got talent: the program should repeatedly prompt the user for a contestant name (each entry is a vote: you can pretend that each time the program prompts the user, it's a different voter). optionally, you can determine the most popular performers and select the top 5 contestents to go head to head in america's got talent ultimate challenge contest. use the following steps to tally the votes and select the contestants.
initialize a dictionary with the keys "darci lynne", "angelica hale", and "angelina green" with each having the value 0.
repeatedly prompt the user for a contestant name to vote for, adding/updating the relevant key/value pair in the dictionary to tally the votes for each contestant. stop prompting when the user enters "done".
after all the votes have been entered, print out all the contestants and their corresponding vote tallies.
optional challenge: compute the 5 most popular contestants and wish them congratulations by name. "congratulations, darci lynne! ". do this after you have the rest of the program working and have tested your code.
Solved
Show answers
More tips
- F Food and Cooking How to Properly Wash a Down Jacket? Tips from Experts...
- C Computers and Internet Thin Client: What It Is and Why You Need It?...
- F Food and Cooking The Most Delicious and Simple Fish in Batter Recipe...
- F Food and Cooking Red Caviar: How to Choose the Best?...
- C Computers and Internet Clearing Cache: How to Speed Up Your Browser...
- S Style and Beauty How are artificial nails removed?...
- S Style and Beauty Secrets of Tying a Pareo: 5 Ways...
- F Food and Cooking Everything You Need to Know About Pasta...
Answers on questions: Engineering
- E Engineering Describe how capacitive and inductive sensors work and illustrate the use of each in a circuit where they are used to detect forward and return stroke limits for a double...
- E English In cranes, song-sam s memory of the old man with the chestnut tree reveals all of the following except:...
- E English What does the suffixmean in the word logical...
- C Chemistry Amagnet is a special that attracts other materials...
- A Advanced Placement (AP) Could buying $2,000 worth of stock on behalf of a client earn more money for a financial planner than buying $1,000? why or why not?...
- B Biology Wykonaj listę przedmiotów znajdujących się w twoim pokoju które zostały wykonane z roślin nasiennych .spróbuj podać nazwy tych roślin....
- P Physics If asked to describe a wave, you could say waves are the disturbance of energy in a material. continuous transmission of energy from one location to the next. movement...
- M Mathematics Which of the following is a solution to the inequality y –2x + 3? a. (1,1) b. (3,0) c. (-3,10) d. (0,0)...
- M Mathematics Simplify the expression: (-2-+6i)...
- M Mathematics 3(n+6) do i do 3xn=3n than 3x6=18 n=6?...
Ответ:
# Initialize a dictionary with the keys
contestants = {"Darci Lynne":0, "Angelica Hale":0, "Angelina Green":0};
# Repeatedly prompt the user for a contestant name to vote for
while True:
# Prompting user for contestant name
cName = input("Enter contestant name to vote: ");
# Checking for Done
if cName.lower() == "done":
break;
# Checking in dictionary
if cName in contestants.keys():
# Updating vote value
contestants[cName] += 1
# New entry
else:
contestants[cName] = 1
# Printing header
print("\n%-20s %-15s\n" %("Contestant Name", "Votes Casted"))
# Printing results
for contestant in contestants:
print("%-23s %-15d" %(contestant, contestants[contestant]))
Ответ:
the gettysburg was a war so was the vicksburg
Explanation:
can i get brainliest plz :)