Double Delight Sale: Flat 70% + Addl. 30% Off + 30-days Extra Lab on all Courses | Use Coupon DS30 in Checkout | Offer Expires In

  Enroll Now

Scala

43 / 52
   

Scala - Assessment - Declare a Map of Char, Int

A map in Scala is like a dictionary or a collection of key-value pairs. You can search the map using key or value.

A simple map having data of states and capitals may look like this:>br>

val capitals = Map("AZ" -> "Phoenix", "CA" -> "Sacramento")

Now, let's declare a map depicting the alphabets and their position. So, this map will be of type (Char, Int) and let's name it charMap. The data of the map will be as below.

  • A,1
  • B,2
  • C,3

Think about how such a map will be defined.

INSTRUCTIONS
  • Switch to Jupyter tab.

  • Declare the map variable as per the requirement in Jupyter.

  • Press Shift+Enter.

  • Submit your answer.


No hints are availble for this assesment

Answer is not availble for this assesment


Note - Having trouble with the assessment engine? Follow the steps listed here

Loading comments...