Go to Chapter 22 in A Smarter Way.
You can put a for-loop inside another for-loop:
first_names = ["Bill", "Joel", "Jeff", "Jim"] last_names = ["E-boy", "E-man", "Jefferson", "O'theJungle"] full_names - [ ] for a_first_name in first_names: for a_last_name in last_names: full_names.append(a_first_name + " " + a_last_name)
- In your examples.py script, create two lists of friends’ first names and last names, plus the empty list to hold the full name. Be creative!
- Now use the nested for-loops to populate the empty list.
- Print your list of friends. Don’t forget to properly format the strings.