Don't make your own alphabet string.
You have forgotten the n.
This means, if you have 51 elements/letters, the last letter in this list is at index 50. The first letter is at index 0.
You need to learn more about slicing: https://stackoverflow.com/questions/5092...e-notation
Read the documentation about randrange and randint.
For randrange you can use the output from len. With randint the stop value is inclusive. This means it is len(your_strig) + 1.
You have forgotten the n.
import string print(string.ascii_letters)The IndexError is raised, because you try to access the 51th element, but the indexing starts with 0.
This means, if you have 51 elements/letters, the last letter in this list is at index 50. The first letter is at index 0.
You need to learn more about slicing: https://stackoverflow.com/questions/5092...e-notation
Read the documentation about randrange and randint.
For randrange you can use the output from len. With randint the stop value is inclusive. This means it is len(your_strig) + 1.
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
All humans together. We don't need politicians!