- 2022-07-13 17:17
*views 2*- 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
- algorithm107 blogs
- MySQL96 blogs
- Flow Chart81 blogs
- javascript79 blogs
- more...

Daily Recommendation

views 10

views 4

views 4

views 3

views 3

© ioDraw All rights reserved

1.k- Nearest neighbor algorithm （KNN）mysql Trigger instance update_mysql Trigger example description 2022 Video games School Games 【 assembly 】 Introduction to the common test questions of big data development Spark Hongmeng 3.0 Google code will be deleted , Just to make the domestic system more pure MySQL Statistics of total sales data of each month C language C++ Develop magic tower game （ Two layers ）Java Logging function call stack method Long press to realize the function of on / off （ Implementation without code , Peripheral chip ） utilize idea yes mysql Add, delete, check and modify