Let's put together Python for super beginners https://qiita.com/kkhouse/items/675b846d0bcf41cd191f
Python beginners talk about how to remember this much https://qiita.com/kkhouse/items/74d7acb768e6542339ac
Python amateurs try to summarize the list ① https://qiita.com/kkhouse/items/a6cc69b81428701d12b2
It is a continuation of this area. I haven't made it into a series, but I have a feeling that it will be a series. We have set a limit on the amount of time we can spend, so this time we will rush to summarize the list.
Last time, I was grateful to hear that the method was called a method. I am grateful for your suggestions and will continue to do so.
Since it's a big deal, I'll summarize it by giving various methods.
In programming, there is the idea of index numbers. Simply put, it is the number attached to each element in the list. The first element is 0, and the numbers are added in order after that.
list = ["Kansai","Kanto","Tohoku"]
If there is a list, the index numbers are 0 for Kansai, 1 for Kanto, and 2 for Tohoku. Note that it starts from 0.
You can call the corresponding element by entering the index number with  in the variable containing the list.
Well the main subject. About the method L.index (x, start, end)
list = [1,2,3,4,5,6] ind_list = list.index(3,1,5) print(ind_list) #3
It's a bit complicated to write, but the element in () of the method () is called an argument, and in the above list, it is the first argument 3, the second argument 1, and the third argument 5. The index method then looks for the first argument between the second and third arguments. (Search for the numerical value 3 from index numbers 1 to 4) * Since the index of the last element is the number of elements -1, 5 in index (3.1,5) represents the 4th.
L.insert(x,i) The insert method adds the second argument to the location specified in the first argument.
list = [1,2,3,4,5,6] print(list.insert(2,3.5) #[1,2,3,3.5,4,5,6]
Note that it starts at 0
Also, I often use the len function to get the number of elements in the list. len (list) gets the number of elements in list.
list = [1,2,3,4,5] print(len(list)) #5
The list has an applied expression called comprehension. Since the if statement is involved, I will write it after summarizing the if statement.
See you tomorrow ~