Data Type Conversion
You may have to implement conversions between the supported variable types. To do this,
you just have to utilize the type title as a function.
Multiple pre-installed functions can be employed to complete data conversions from one
type to another. These built-in functions produce a new object displaying the value.
Chapter 6: More Information Regarding
Python Lists
Chapter 6: More Information Regarding Python Lists
A list is a type of data that can be written as a group of items separated by commas. The
objects included in a list do not have to be of the same data type. It is considered as the
most versatile variable type in Python.
To create a list, you just have to collect values (separated by commas) and place them
inside a pair of square brackets.
Just like a string index, indices for Python lists begin at 0.
They can also be linked, sliced, etc.
How to Access Values inside a List
If you want to access values you placed in a list, then slice the value that you need using
the square brackets.
When properly executed, the command will produce the information
you need.
How to Update Lists
If you want to add new elements into an existing list, place the slicer (the brackets) on the
left side of your operator. Afterwards, use the append () technique to add the variables.
You have two options when deleting elements from a list: (1)
execute the del statement
(use this if you know the specific elements that you want to remove), or (2) use the
remove () technique (this is useful if you still do not know the elements to be deleted).
Conclusion
Conclusion
Thank you again for downloading this book!
I hope this book was able to help you to become more familiar with the Python
programming language.
The next step is to write your first program using Python.
Finally, if you enjoyed this book, then I’d like to ask you for a favor,
would you be kind
enough to leave a review for this book on Amazon? It’d be greatly appreciated!
Click here to leave a review for this book on Amazon!
Thank you and good luck!