Print ("Today to learn the list")
The # list consists of a series of elements arranged in a particular order. You can create a list of names that contain letters, 0-9 numbers, and all family members.
# Since lists generally contain a lot of things, the names are usually in plural form, letters, digits, names like this
# in Python, use [] to represent the list and use it to separate the elements.
Bicycles = [' Trek ', ' Cannondale ', ' redline ', ' specialized ']
Print (bicycles)
# The list is ordered and can be determined by the index or location of the element
Print (Bicycles[0])
# Plus. Title () capitalize more comfortable
Print (Bicycles[0].title ())
# When you don't know how long the list is, but you want to access the last element of the list, you can use [-1] to access it, which means starting with the last element
Print (Bicycles[-1].title ())
# you can use string concatenation to work with values in the list
Message = "Today I want to use" +bicycles[0].title () + "to go to school."
Print (message)
# Practice
# Save the name in the names and then visit it one by one, either by names[0],names[1], or by using for to access
# Add a greeting after the name
names = [' AA ', ' BB ', ' CC ']
For a in range (len (names)):
Print (names[a]+ "Say hello to You")
Learn a little every day ~
The re-learning of python----Simple list (1)