Python functions.
1. Given a list of words, return an array which indicates the frequency that
each letter occurs. For example, in the list ["apple", "bob"], [ 'a' -> 1,
'b'->2, 'e'->1, 'l'->1, 'o'->, 'p'->2] . The order of the array does not
matter and a Frequency class will be provided.
2. Given a list of words, indicate whether the list constitutes a "Word Lad-
der." Return a True or False (Boolean) A Word Ladder is a series of words where each succeeding word
changes by only one letter. You may not assume that all words will be of
the same length, and you may not assume the length of the list.
3. Given an integer greater than 2, X, return an array populated with all
prime numbers up to and including X.

Recommended Answers

All 6 Replies

This is a java forum.
For the first, you can have an int array of length the number of letters in the alphabet (24 or 26)
Loop each String of the list and take each character and increase the right element of the array by one.
the first element for example would be how many 'a' are found.

Python functions.

2. Given a list of words, indicate whether the list constitutes a "Word Lad-
der." Return a True or False (Boolean) A Word Ladder is a series of words where each succeeding word changes by only one letter. You may not assume that all words will be of
the same length, and you may not assume the length of the list.

Write a Python function

3. Given an integer greater than 2, X, return an array populated with all
prime numbers up to and including X.

Compare each character of 2 words. If you find more than 1 change or you find zero changes then the list is not a word ladder

not urgent

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.