1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
vodomira [7]
3 years ago
9

Write a script that will read the file, (strip the carriage returns), create a dictionary of names and favorite radishes and cre

ate a dictionary of each radish type and the number of people who chose that as their favorite.

Computers and Technology
1 answer:
amm18123 years ago
8 0

Answer:

python code below:

names={}#first dictionary for names and favorite

favor={}#radish type and how many are favorite

f=open("raddish.txt")#opening file

for i in f:#for each line

j=i.strip().split("-")#splitting base on -

names[j[0].strip()]=j[1].strip()#getting first dictionary

if j[1].lower().strip() in favor:#counting the favorite elements

favor[j[1].lower().strip()]+=1

else:

favor[j[1].lower().strip()]=1

print ("First Dictionary",names)#printing the names

print("second dictionary:",favor)#printing the favorite numbers

f.close()#closing file

Explanation:

The program was implemented using python programming language.

Its operation is to read the file, (strip the carriage returns), create a dictionary of names and favorite radishes and create a dictionary of each radish type and the number of people who chose that as their favorite.

It returns as output the names of people entered for the Radishes.

See attachment for screenshot.

You might be interested in
Which of the following are characteristics of a good webmail message select all that apply
emmainna [20.7K]

add choices please :)


6 0
3 years ago
During which part of geologic time were dinosaurs most common?
ANTONII [103]
The answer is C. Jurassic.
6 0
3 years ago
Read 2 more answers
Which of the following is the largest unit of information?
Mila [183]
What are the choices?

5 0
3 years ago
Read 2 more answers
Which of the following statements isNOT true about abstract data types (ADTs)?A list is anexample of an ADT.ADTs hide theimpleme
Fynjy0 [20]

Answer:

Java provide all the ADTs you need,therefore you do not need to create any newones.

This statement is not true.

Explanation:

ADTs are those data types which we use but we didn't know their inner working that is how it is working what is happening inside.It is commonly used for Data Structures for example:- In stack we use push and pop operations to insert and to delete element from a stack respectively but we didn't know how it is happening inside.How the stack is implemented and etc.Java provides most of the ADT's but not all.

5 0
3 years ago
I need help please?!!!!
mrs_skeptik [129]
It would be wear a seatbelt
6 0
3 years ago
Read 2 more answers
Other questions:
  • Write a program that calculates an adult's fat-burning heart rate, which is 70% of 220 minus the person's age. Complete fat_burn
    10·1 answer
  • The time between requests to a web server is exponentially distributed with mean 0.5 seconds. NOTE: This is a multi-part questio
    8·2 answers
  • A ________ pays out cash flows from a collection of assets in different tranches, with the highest-rated tranch paying out first
    8·1 answer
  • An excel user should use a relative cell reference when it is important to ____. preserve the relationship to the formula locati
    7·1 answer
  • It can be useful to have a mentor because they will help you
    7·2 answers
  • A network administrator is required to upgrade wireless access to end users in a building. To provide data rates up to 1.3 Gb/s
    12·1 answer
  • What do you call the process of translating statements written by a developer? What is the result of this process?
    6·1 answer
  • What is the safest way to install a new flash drive
    7·2 answers
  • You work in the Accounting Department and have been using a network drive to post Excel workbook files to your file server as yo
    9·1 answer
  • Why does 5 g mm wave require more cells to achieve a better signal
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!