- 2022-07-13 17:17
*views 8*- Big Data
- Qian Feng
- teacher song —Python special column
- Python
- Song song talks about programming

Share with you today 30 individual Python Common code cases , It is recommended to collect ~

1, Bubble sort

2, calculation x of n Power method

3, calculation aa + bb + c*c + ……

4, Calculate factorial n!

5, List all files and directory names under the current directory

6, Put one list All strings in become lowercase ：

7, Output the paths of all files and folders under a certain path

8, Output a path and all file paths under its subdirectories

9, Output a path and all its subdirectories with .html File with suffix

10, Reverse the key value pairs of the original dictionary and produce a new dictionary

11, Print 99 multiplication table

By specifying end Value of parameter , You can cancel outputting carriage return at the end , Realize no line breaks .

12, Replace all in the list 3 by 3a

13, Print each name

** Be good at using range() , Will make the problem simple

14, Merge de duplication

15, Two ways of randomly generating verification code

16, Calculate square root

17, Judge whether the string is only composed of numbers

18, Judge odd and even numbers

19, Judge leap year

20, Get maximum value

21, Fibonacci sequence Fibonacci series refers to such a series 0, 1, 1, 2, 3, 5, 8, 13;

In particular ： Section 0 Item is 0, Section 1 Item is the first 1. Start with the third item , Each term is equal to the sum of the first two terms .

22, Decimal to binary , octal number system , hexadecimal

23, greatest common divisor

23, Least common multiple

24, A simple calculator

25, Generate calendar

26, file IO

27, String judgment

28, String case conversion

29, Calculate the number of days per month

30, Get yesterday's date

-END-

Scan code to add remarks ：python

Technology

- Java296 blogs
- Python265 blogs
- Vue125 blogs
- C Language122 blogs
- Algorithm108 blogs
- MySQL96 blogs
- Flow Chart84 blogs
- JavaScript79 blogs
- More...

Daily Recommendation

views 7

views 6

views 6

views 6

views 6

©2020-2022 ioDraw All rights reserved