Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (47.6k points)

I want to implement a HashMap in Python. I want to ask a user for an input. depending on his input I am retrieving some information from the HashMap. If the user enters a key of the HashMap, I would like to retrieve the corresponding value.

How do I implement this functionality in Python?

HashMap<String,String> 

streetno=new HashMap<String,String>();

streetno.put("1", "Sachin Tendulkar");

streetno.put("2", "Dravid");

streetno.put("3","Sehwag"); 

streetno.put("4","Laxman"); 

streetno.put("5","Kohli")

1 Answer

0 votes
by (106k points)

I want to implement a HashMap in Python. I want to ask a user for an input. depending on his input I am retrieving some information from the HashMap. If the user enters a key of the HashMap, I would like to retrieve the corresponding value.

How do I implement this functionality in Python?

HashMap<String,String> 

streetno=new HashMap<String,String>();

streetno.put("1", "Sachin Tendulkar");

streetno.put("2", "Dravid");

streetno.put("3","Sehwag"); 

streetno.put("4","Laxman"); 

streetno.put("5","Kohli")

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Aug 26, 2019 in Java by Krishna (2.6k points)
0 votes
1 answer

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...