Dictionaries

Creating a dictionary from a list of integers
AskAI

Given a list of integers, this function will return a dictionary with the integers as keys and the number of times the integer appears in the list as values.

Sum of integers divisible by 3 in a list
AskAI

The function should take a list of integers as input and return the sum of the integers in the list that are divisible by 3.

Find the indices of two numbers that add up to the target value in a list of...
AskAI

The problem is to find the indices of two numbers in a list of integers that add up to a given target value. An example input would be [2, 7, 11, 15] with a target value of 9, and the expected output would be [0, 1].

Find the sum of the integers at even indices in a list.
AskAI

Given a list of integers, this program will find the sum of the integers at even indices. So, for the example input above, the output would be 12 (2 + 4 + 6 ).

Counting Elements in a List
AskAI

The technical problem is to write a Python script to return a dictionary containing the count of each unique integer in a given list. For example, given the list [1, 2, 1, 2, 1, 3, 3, 3, 4, 4, 4, 4], the expected output would be {1: 3, 2: 2, 3: 3, 4: 4}.

Counting the Occurrences of Integers in a List
AskAI

This problem asks you to write a function that takes a list of integers and returns a dictionary with the integers as keys and the number of times they appear in the list as values.

Sum of absolute values of integers in a list
AskAI

This problem asks for the sum of the absolute values of a given list of integers. For example, given the list [2, -4, 6, -8], the sum of the absolute values would be 20.

Find the Longest Word in a List
AskAI

This program finds the longest word in a list of words.