walter fernandez4,991 Points
hello i need help with a list
groceries = ['jose', 'app', 'deto'] for i in range(0:3): print('*' + groceries[i]) # i need to get the first two name in my list: #i need this output: * jose # * app
some one, help please.
continents = [ 'Asia', 'South America', 'North America', 'Africa', 'Europe', 'Antarctica', 'Australia', ] # Your code here for i in range(0:3): print('*'+ continents[i])
Hello, u misunderstood the challange, they want u to use a for loop to loop through each element in the contients array.
continents = [ 'Asia', 'South America', 'North America', 'Africa', 'Europe', 'Antarctica', 'Australia', ] # Your code here #u loop through each elemnt of the contients array for contient in continents: #then u want to print each element if the element starts with "A" , u do this by checking if the first index of the element is equal to "A" if(contient == "A"): #if it is we print this element. print("* " + contient)
Steven Parker203,207 Points
Here's a few hints that may help:
- arguments should be separated by a comma (,) instead of a colon (:)
- you should print all the continents, but "
range(0,3)" will only print the first 3
- you don't really need an index, you might use the list itself as the iterable
- anything that is part of a loop must be indented more than the "for" line
- add a space after the asterisk to keep it from being right next to the name