patterns = ["Scissors", "Rock", "Paper"]
for i in range (len(patterns)):
print(patterns[i])
Here's a question for the masters. ㅠ<
I don't know why Len's usage and patterns [i] are used here.
We learned that i after for is a variable created by for iterations.
patterns[0] is the first value of the list called patterns
I understand that pattern[1] is the second value in the list called pattern...
for python
I got the length of the list using len. You need to get the length to get the index value from zero to length.
But the code of the question is not good code. There's a lot of useless work.
If you simply write it as below, you will get the same result.
patterns = ["Scissors", "Rock", "Paper"]
for pattern in patterns:
print(pattern)
© 2024 OneMinuteCode. All rights reserved.