This article will talk about the python code encyclopedia and usage, as well as the simplicity of the python code encyclopedia. I hope it will be helpful to you. Don’t forget to bookmark this site.
1. Bubble sorting
2. Method of calculating x raised to the nth power
3. Calculate a*a + b*b + c*c + ……
4. Calculate factorial n!
5. List all files and directory names in the current directory
6. Change all strings in a list to lowercase:
7. Output the paths of all files and folders under a certain path
8. Output all file paths under a certain path and its subdirectories
9. Output all files with the .html suffix in a certain path and its subdirectories.
10. Reverse the key-value pairs of the original dictionary and produce a new dictionary
11. Print the multiplication table
By specifying the value of the end parameter, you can cancel the output of the carriage return character at the end and achieve no line breaks.
12. Replace all 3’s in the list with 3a
13. Print each name
** Being good at using range() will make the problem simpler
14. Merge and remove duplicates
15. Two ways to randomly generate verification codes
16. Calculate square roots
17. Determine whether a string consists only of numbers
18. Determine odd and even numbers
19. Determine leap year
20. Get the maximum value
21. Fibonacci Sequence
The Fibonacci sequence refers to a sequence of 0, 1, 1, 2, 3, 5, 8, 13; specifically: the 0th item is 0, and the 1st item is the first 1. Deepl weight reduction . Starting with the third term, each term is equal to the sum of the previous two terms.
22. Convert decimal to binary, octal, hexadecimal
23. Greatest common divisor
23, least common multiple
24. Simple calculator
25. Generate calendar
26. File IO
27. String judgment
28. String case conversion
29. Calculate the number of days in each month
30. Get yesterday’s date
Source: Zen of Python
Copyright statement: The content comes from the Internet, and the copyright belongs to the original author. Unless it cannot be confirmed, we will indicate the author and source. If there is any infringement, please inform us and we will delete it immediately and apologize. Thanks!
- EOF -