Skip to content
Advertisement

Tag: dictionary

how can I fix this program so it won’t return ‘unknown’ for negative input (boiling_point)

Here’s the given for the problem I’m trying to solve: *python Write a function that given a mapping from material to boiling points, and a boiling point temperature, will return : the material corresponding to the boiling, if it is within 5% difference ‘UNKNOWN’ otherwise Function signature should look like : boiling_material(boiling_map, boiling_point) An example boiling_map : Given input :

When does a HashTable / Python dict stop probing?

In Java I’m building a datastructure that is supposed to resemble dictionaries in Python. (As far as I understand this is called a “HashTable” in java context.) I have read the following Python documentation in order to arrive at the probing function (as I wished to prevent using linear probing) Now I have come to a point where Im trying

Executing functions through dictionaries

My script executes depending on user’s input, like this: The problem is that I can have over 15 different choices, so I would like to make it cleaner using dicts, but I can’t get it to work. This is what I did. In the class init for sh: And so on. Further down in the class: And finally the input

how to print everything from a dictionary?

I’m trying to do this question for class that is really confusing me, I can’t seem to figure it out. They give me this code and say that I need to do something to make it print all of the flowers in the dictionary instead of printing just one. Here is the code that is provided, which just prints one

Advertisement