Python Introducing Lists Using Lists Continental

Michael Kaminski
Michael Kaminski
1,320 Points

I can't seem to get the for loop to print the 2 continents only one time, and I want to know how to run a for loop once.

For the continental code challenge I enter a for loop to iterate through the list of continents

continents = ['Asia','South America', 'North America', 'Africa', 'Europe', 'Antarctica', Australia']

I enter for continent in continents: print("* ",continent[0]) print("* ",continent[1])

This gives me the right answer but repeats it forever. I thought we had to use a for loop, and I am confused as to how to make it just go through the list and print it out just one time.
continents = [
    'South America',
    'North America',
# Your code here
for x in range(0,1):
    for continent in continents:
        print("* ",continents[0])
        print("* ",continents[1]) 

1 Answer

Steven Parker
Steven Parker
201,957 Points

Here's some hints:

  • you only need one loop
  • you also only need one "print" statement
  • the print statement should use the loop variable to print a different name each time
  • indexing is not needed for this task