100 basic Python questions sorted out by staying up late during the college entrance examination, learning is earning! super detailed

Python is very popular in the programming circle, and it has become popular in the programming circle in the past two years. More and more friends who are not programmers have also learned about Python, but the requirements for Python positions are also getting higher and higher. Whether you are a zero-based or an old-timer, you should not take Python interviews lightly.

insert image description here

It took a week to sort out 100 Python exercises. If you are a beginner, then this exercise will bring you great help. If you can complete this exercise completely independently Question, you have already started with Python, and the practice questions cover most of the basics of Python:

Procedure 001: Number Combinations

There are four numbers in the question: 1, 2, 3, 4, how many different three-digit numbers can be formed without repeating numbers? How much is each?

Program analysis makes all python traversal possible, and shaves off duplicates.

picture

Procedure 002: "Individual Tax Calculation"

Bonuses issued by enterprises are based on profit promotion. When the profit (I) is less than or equal to 100,000 yuan, the bonus can be increased by 10%. 7.5%; between 200,000 and 400,000 yuan, 5% can be deducted for the part higher than 200,000 yuan; between 400,000 and 600,000 yuan, 3% can be deducted for the part higher than 400,000 yuan; When the time exceeds 600,000 yuan, a 1.5% commission can be obtained; when it exceeds 1 million yuan, the portion exceeding 1 million yuan will receive a 1% commission. Enter the current month's profit I from the keyboard to find out the total amount of bonuses to be paid out?

picture

Procedure 003: Perfect Squares

The title is an integer. After adding 100, it is a complete square number, and after adding 168, it is a complete square number. What is the number?

Program analysis Because 168 is too small for exponential explosion, mathematical analysis can be omitted directly, and the upper limit can be obtained in the simplest way:

picture

Procedure 004: What day is the day

Enter a certain year, month, and day in the title, and judge whether this day is the day of the year?

The program analyzes the special situation, and it needs to consider adding an extra day to February in leap years:

picture

Example 005: Three-number sorting

The title input three integers x, y, z, please output these three numbers from small to large.

For program analysis and practice, just find a sorting algorithm to implement it, and if you are lazy, just adjust the function directly.

picture

This full version of the full set of Python learning materials has been uploaded to CSDN. If you need it, you can scan the QR code of CSDN official certification below on WeChat to get it for free【保证100%免费

Guess you like

Origin blog.csdn.net/Yuki1127918/article/details/131170204