Python
1, suppose aaa=[1,1,1,3,5,2,6,1,7,3,45], how do you use Python to filter out the numbers repeated in the list?
>>>list (Set (AAA))
2, briefly describe the difference between list and tripe
List is dynamic, set up can be deleted elements, and tripe is static, can not delete elements, and tripe will automatically go heavy.
3. Briefly describe the difference between search () and match ()
4, how to generate a random number?
>>>import Random
>>>random.random ()
"comment" This will generate a floating-point number between 0~1.
5. Suppose aaa=["Messi", "Neymar", "Luis Suarez", "Pico", "Busquets", "Iniesta"],bbb=["Pico", "De Gea", "Ramos", "Iniesta", "Fa Fabregas", "Busquets", how to find the intersection and difference between the two lists?
Intersection: Ccc=[val for Val in AAA if Val in BBB]
Difference set: Ddd=[val for Val in AAA if Val not in BBB]
"Comment" DDD this difference is the AAA this list has but BBB does not have, if you want to show the BBB has and AAA not the elements, then switch Ddd=[val for Val in BBB if Val not in AAA]
6 . Reverse the string consisting of a word and an indefinite number of spaces, requiring the alphabetical order of the words to be the same. such as: "I love this game!" Invert into "game! This Love I ".
>>> Import re
>>> AAA = "Ilove this game!"
>>> bbb= '. Join (Re.split (R ' (\s+) ', AAA) [::-1])
>>> Print (BBB)
"comment" This problem although a few words, but really difficult.
This article is from "Life is waiting for Gordo" blog, please make sure to keep this source http://chenx1242.blog.51cto.com/10430133/1742467
Linux Operations engineer face test fourth set