I’m getting this error message :
TypeError: list indices must be integers or slices, not float
In resume , for educational purpouses i write a small program where respectively I:
1º I start declaring one variable = 0, that variable will be my index start
2º I create another variable that will be my index ending,I force the Python to assume is an integer by using Index_Final = int(input(‘wath is your last index: ‘)
3º I create an empty list, that will be filled later inside the loop.
4º I open the loop using while ( startingindex < endingindex ) :
5º I ask for the elements that compose the list, that will be filled.
6º I use append list method to fill, incrementing the list index one by one.
7º I dictate that moves foward to the next index to be filled by using startingindex = startingindex + 1 or simply writting startingindex += 1
RAFAEL OREIRO RODRIGUEZ is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1