Dictionaries and its Methods

  1. Dictionary and Operations

    Question 1 of 2

      Assign student_info as {'name': 'Ram', 'age': 22, 'grade': 'A', 'courses': ['DS', 'SQL']}
      1. Find and display student's name, age, grade and courses enrolled with proper formatting
      2. Update student's grade to 'A+' and display updated dictionary
      3. Add 'level' key with value 'Beginner' and display updated dictionary
      4. Add one more course 'Python' to student's courses and display updated dictionary
      5. Remove age from student information and display updated dictionary
      6. Check if 'address' key is present in student information
      7. Find and display total number of items in student information
      8. Create a copy of this dictionary, update name to 'Bob', grade to 'B' and display both dictionary
  2. Membership and Update

    Question 2 of 2

    • Courses offered by college is stored in dictionary as 'course': ['DS', 'SQL', 'Python'], 'duration': [40, 50, 60]. Check if Python is offered in college
    • College_1 has course as {'python': {'duration': 3, 'type': 'basic'}, 'java': {'duration': 4, 'type': 'medium'}}. College_2 has course as {'multimedia': {'duration': 2, 'type': 'basic'}, 'javascript': {'duration': 5, 'type': 'advanced'}}. College_1 acquired College_2. Update College_1 course with College_2's and display the updated result
    • Assign translation_dict as {'hello': 'hola', 'thank you': 'gracias', 'goodbye': 'adios', ...}. Ask user to input a word in English and display its translation in Spanish. If word is not found, display Translation not found
    • Using range function, generate a list of even numbers from 0 to 20 and display the result
    • Using range, generate and display multiplicate of 3 from 30 to 1 in descending order