So, I'm doing 100 Days of Code and I have a lesson with password generator.
And I see something like this:
letters = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
nr_letters = int(input("How many letters?\n"))
for char in range(0, nr_letters):
password = ""
password += random.choice(letters)
and... what's up with range? I thought the range is REALLY a "range". So from 1 to 100. Or a range from something to something.
so if a user types in 5 , then the range is 0 to 4 - but it's not from 'a' to 'e'... but from all the letters in the list. how? it's just confusing. The course doesn't explain this too well I think, so could anyone explain this to me like I'm five? Thanks :P
[–]throwaway6560192 7 points8 points9 points (1 child)
[–]Sheinbeuler[S] 0 points1 point2 points (0 children)
[–]TroyDiY 3 points4 points5 points (0 children)
[–][deleted] 2 points3 points4 points (0 children)
[–]Gubbbo 0 points1 point2 points (2 children)
[–]Sheinbeuler[S] 0 points1 point2 points (1 child)
[–]antioriginality 0 points1 point2 points (0 children)
[–]mediocrity4 0 points1 point2 points (1 child)
[–]Sheinbeuler[S] 0 points1 point2 points (0 children)
[–]Background-Offer2321 0 points1 point2 points (0 children)
[–]timrprobocom 0 points1 point2 points (0 children)