I am an absolute beginner in programming, so please forgive my utter lack of understanding.
I came across this concept quite recently through a course I am taking in Python. I re-watched the lessons, I have tried doing some separate research on this topic, but I am still having a hard time wrapping my head around it.
The project I am currently working on is a random password generator. I was stumped and couldn’t figure it out on my own so I watched the teacher’s solution as a last resort. Especially puzzled when she used this code:
password = "" for char in password_list: password += char
For context, this code is supposed to convert a list of characters (from password_list) into a string.
I thought that for loops were used for iteration. I am only familiar with using “for __ in __ range(a, b)” so far, so I was quite puzzled by this loop as I don’t understand how it works. Could someone please help me break it down into simpler terms? That would be super appreciated.
Please and thank you.
submitted by /u/deorojeu
[link] [comments]
r/learnpython I am an absolute beginner in programming, so please forgive my utter lack of understanding. I came across this concept quite recently through a course I am taking in Python. I re-watched the lessons, I have tried doing some separate research on this topic, but I am still having a hard time wrapping my head around it. The project I am currently working on is a random password generator. I was stumped and couldn’t figure it out on my own so I watched the teacher’s solution as a last resort. Especially puzzled when she used this code: password = “” for char in password_list: password += char For context, this code is supposed to convert a list of characters (from password_list) into a string. I thought that for loops were used for iteration. I am only familiar with using “for __ in __ range(a, b)” so far, so I was quite puzzled by this loop as I don’t understand how it works. Could someone please help me break it down into simpler terms? That would be super appreciated. Please and thank you. submitted by /u/deorojeu [link] [comments]
I am an absolute beginner in programming, so please forgive my utter lack of understanding.
I came across this concept quite recently through a course I am taking in Python. I re-watched the lessons, I have tried doing some separate research on this topic, but I am still having a hard time wrapping my head around it.
The project I am currently working on is a random password generator. I was stumped and couldn’t figure it out on my own so I watched the teacher’s solution as a last resort. Especially puzzled when she used this code:
password = "" for char in password_list: password += char
For context, this code is supposed to convert a list of characters (from password_list) into a string.
I thought that for loops were used for iteration. I am only familiar with using “for __ in __ range(a, b)” so far, so I was quite puzzled by this loop as I don’t understand how it works. Could someone please help me break it down into simpler terms? That would be super appreciated.
Please and thank you.
submitted by /u/deorojeu
[link] [comments]