What are the tips for writing Python code?
This article mainly introduces "what are the tips for writing Python code". In the daily operation, I believe that many people have doubts about the tips for writing Python code. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts about "what are the tips for writing Python code?" Next, please follow the editor to study!
One line of code shows 1:
First_name = "Json"
Last_name = "smart"
# not recommended
Full_name = first_name + "" + last_name
# recommended, efficient
"" .join ([first_name, last_name])
One line of code shows 2:
From itertools import combinations
Print (list (combinations ('12345)
[('1percent,' 2'), ('1percent,' 3'), ('1percent,' 4'), ('1percent,' 5')
('2percent,' 3'), ('2percent,' 4'), ('2percent,' 5')
('3,'4'), ('3,'5')
('420,' 5')
]
At this point, the study of "what are the tips for writing Python code" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!