Skip to content

Module 4 challenge: Strings, Lists, and Dictionaries :Crash Course on Python (Google IT Automation with Python Professional Certificate) Answers 2025

1. confirm_length function
✔️ if len(word) > 0: return len(word)
if word != "": return word
if len(word) >= 1: return word.upper()

2. highlight_word function
✔️ return sentence.replace(word, word.upper())
return sentence.upper(word)
return sentence[word].upper()

3. combine_lists function
✔️ list1.reverse(); combined_list = list2 + list1
combined_list = list2.append(list1)
combined_list = list2 + list1.reverse()

4. squares function
✔️ [n**2 for n in range(start, end+1)]
[n*n for n in range(start, end)]
[n**2 for n in range(start, end)]

5. countries function
✔️ for continent, country_list in countries_dict.items(): result += ", ".join(country_list) + "\n"
for continent in countries_dict: result += countries_dict[continent]
result = str(countries_dict.values())

6. setup_guests function
✔️ result = {}; for guest in guest_list: result[guest] = 0
for guest in guest_list: result.add(guest,0)
for guest in guest_list: result[0] = guest

7. count_numbers function
✔️ for char in text: if char.isdigit(): dictionary[char] = dictionary.get(char,0)+1
for char in text: dictionary[char]+=1
for char in text: if char in "0123456789": dictionary[char] = 0

8. car_make slicing
✔️
mbo
hini
Lambo
❌ Other options: borgh, ghin, org or bor, hini, Lamborghini

9. music_genres list after append
✔️ ['rock', 'pop', 'country', 'blues']
['rock', 'pop', 'blues']
['rock', 'blues', 'country']

10. teacher_names.values()
✔️ dict_values(['Aniyah Cook', 'Ines Bisset', 'Wayne Branon'])
dict_values(['Math', 'Science', 'Engineering'])
dict_values({"Math": "Aniyah Cook", "Science": "Ines Bisset", "Engineering": "Wayne Branon"})


📌 Summary Table

Q# Final Answer
1 len(word)
2 sentence.replace(word, word.upper())
3 list1.reverse(); combined_list = list2 + list1
4 [n**2 for n in range(start, end+1)]
5 for continent, country_list in countries_dict.items(): result += ", ".join(country_list) + "\n"
6 result = {}; for guest in guest_list: result[guest] = 0
7 for char in text: if char.isdigit(): dictionary[char] = dictionary.get(char,0)+1
8 mbo, hini, Lambo
9 ['rock', 'pop', 'country', 'blues']
10 dict_values(['Aniyah Cook', 'Ines Bisset', 'Wayne Branon'])