![amandaiscool22](/avatars/28993.jpg)
amandaiscool22
29.10.2020 •
Computers and Technology
Write a program that accepts the names of three political parties and the number of votes each received in the last mayoral election. Display the percentage of the vote each party received.
Solved
Show answers
More tips
- S Sport How to wrap boxing hand wraps? Everything you need to know!...
- F Family and Home How to Sew Curtain Tapes: Best Tips from Professionals...
- A Animals and plants How to Grow Lime from a Seed: Simple Tips and Interesting Facts...
- C Computers and Internet How to Create a Folder on Your iPhone?...
- G Goods and services How to sew a ribbon: Tips for beginners...
- F Food and Cooking How to Make Mayonnaise at Home? Secrets of Homemade Mayonnaise...
- C Computers and Internet Which Phone is Best for Internet Surfing?...
- F Food and Cooking Everything You Need to Know About Pasta...
- C Computers and Internet How to Choose a Monitor?...
- H Horoscopes, Magic, Divination Where Did Tarot Cards Come From?...
Answers on questions: Computers and Technology
- C Computers and Technology Why do the optical signals used in optical fibre cables have avery short wavelength?...
- M Mathematics Expand the binomial (2x+5)^5...
- P Physics Adipole is oriented along the x axis. the dipole moment is p (= qs). (assume the center of the dipole is located at the origin with positive charge to the right and negative...
- E English Read the paragraph and answer the question. (1) some artists use junk to create their work. (2) they may create mosaics, collages, or even sculptures out of pieces no one...
- H History What was a result of the treaty of verdub in 843?...
- B Biology Which organism is an autotroph a)mushroom b)oak tree c)parrot fish d)e.coli bacterium...
- C Chemistry Acell contains a. bacteria and other small organisms. b. smaller structures that it do its job. c. a gel-like liquid with no structures. d. only empty space....
- C Computers and Technology The format cells dialog box tab that provides options for locking or hiding cells to prevent other users from modifying their contents is...
- H History The pottery wheel was invented in china o egypt india mesopotamia...
- H Health What is confabulation? ? confusing a made-up answer as a memory of an actual experience ? having the two sides of the body working antagonistically ? confusing procedural...
Ответ:
Written in Python
parties = []
votes = []
total = 0
for i in range(0,3):
party = input("Party: ")
vote = int(input("Vote: "))
parties.append(party)
votes.append(vote)
total = total + vote
for i in range(0,3):
print(parties[i]+"\t\t\t"+str(votes[i])+"\t\t\t"+str(round((votes[i])*100/total,2))+"%")
Explanation:
This declares an empty list for parties
parties = []
This declares an empty list for votes
votes = []
This initializes total votes to 0
total = 0
The following iteration allows user to enter details for party and corresponding votes
for i in range(0,3):
party = input("Party: ")
vote = int(input("Vote: "))
parties.append(party)
votes.append(vote)
This calculates the total vote
total = total + vote
The following iteration prints the required details
for i in range(0,3):
print(parties[i]+"\t\t\t"+str(votes[i])+"\t\t\t"+str(round((votes[i])*100/total,2))+"%")
Ответ:
Digital formats allow for lossless data storage, fast editing (without the loss of original source material, ie having to manually clip pieces of film), and made collaboration easier.