Descargar el Código: patreon.com/pythonmaraton
Join Patreon: patreon.com/pythonmaraton
^Downloadable code & more! A quick tutorial on how to index strings and lists in python. This is a video about string and list indexing in python. Indexing allows you to see and edit different parts of the string. The basic format is List_name[Start : Stop : Step/direction]. The same thing can be done with strings, but with each character as a value. The basic format is String_name[Start : Stop : Step/direction]
This is a Python anaconda tutorial for help with coding, programming, or computer science. These are short python videos dedicated to troubleshooting python problems and learning Python syntax. For more videos see Python Help playlist by Rylan Fowers.
✅Subscribe: / @pythonmaraton
📺Channel: / @pythonmaraton
▶️Watch Latest Python Content: • Python String Slice and List Slice
▶️Watch Latest Other Content: • Video
How to index Lists and strings
We are making a simple list 0 through 5 here named L by placing brackets and entering values separated by commas
For indexing you type the name of the list, bracket, and numbers for a starting point, a stopping point, and a step size or direction. We have typed 0 here for the first number in the list, here is the list again so you can see it.
In the same way 2 brings up the third position
If you have a negative number it will go backwards so -1 brings up the 5
You can put a colon after a number to bring up that value and all the values after it. As we have done here
Or you can put a colon and a number to bring all the values up to that second number spot
There is also an option to put a third number that allows it to skip. Here we have a two and it brings up every other number from position 0 to 5
For a last example if we want to start on the last value, go to the end in the backwards direction we can put a negative in the last spot. So in this example, it will step backwards hitting every value.
You can do the same thing with strings
Here we define a variable x as a string
This will print the characters of the string from the second spot to the end
This will start from the last character, go through the end of the word in the backwards direction
Lastly, this will start in the first character and go to the third character skipping every other character…. So we end with sr
There you have it, that is how you do string and list indexing
#PythonMarathon #LearnPython #PythonTutorial
In questa pagina del sito puoi guardare il video online Python String Slice and List Slice della durata di ore minuti seconda in buona qualità , che l'utente ha caricato Python Marathon 26 luglio 2018, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 707 volte e gli è piaciuto 11 spettatori. Buona visione!