Languages


Submit solution

Points: 10 (partial)
Time limit: 8.0s
Memory limit: 64M

Author:
Problem type
Allowed languages
Python

Problem Statement

The details of official and other spoken languages of our five South Indian states are given below:

  1. Andhra Pradesh

    Official Languages - Telugu, English; Other spoken languages - Urdu, Hindi, Banjara, Tamil, Kannada, Marathi, Oriya

  2. Karnataka

    Official Languages - Kannada, English; Other spoken languages - Urdu, Telugu, Tamil, Marathi

  3. Kerala

    Official Languages - Malayalam, English, Other spoken languages - Hindi, Kannada, Tamil, Tulu

  4. Tamilnadu

    Official Languages - Tamil, English; Other spoken languages - Telugu, Kannada, Urdu, Malayalam, Hindi

  5. Telangana

    Official Language - Telugu, Urdu; Other spoken languages- Hindi, Tamil, Kannada, Marathi, Oriya

Store these details using appropriate data organization, and answer the following in the form of a menu-driven python program.

  1. Which is the state that uses the maximum number of languages?
  2. When a state name is given as additional input, list the number of spoken languages in that state, excluding official languages.
  3. When a language name is given as input, display the state names where it is a spoken language and not an official language.
  4. List the unique languages - a language used only in one of the states.

Input Format

For options 1 and 4 the only input is the menu choice (1, and 4 respectively).

For the second and third options, there will be two inputs - menu choice and name of the state/language separated by a comma (Eg: - 2,Tamilnadu or 3,Urdu). Please note that there is no space between the menu value and the name of the state/language in the case of options 2 and 3.

An invalid menu value ( a value outside the range 1 to 4) gets the output message "Error".

Output Format

  • Option 1 - State Name
  • Option 2 - Count of spoken languages in the chosen state.
  • Option 3 - name(s) of state(s) whose spoken language list contains the given language. In the case of multiple states, the names are listed in the same line separated by a single space.
  • Option 4 - names of unique languages, in separate lines
  • Any other number as option - Error

Sample Input1

1

Sample Output1

Andhra Pradesh

Sample Input2

2,Kerala

Sample Output2

4


Comments

There are no comments at the moment.