Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the basic exercise topics of Python

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

This article mainly explains "what are the basic exercise topics of Python". The content of the explanation is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "what are the basic exercise topics of Python"?

1 、

Topic: there are five numbers: 1, 2, 3, 4, how many 4 digits that are different from each other and have no repetition? How much is each?

Program analysis: the numbers that can be filled in thousands, hundred, ten, and individual digits are 1, 2, 3, 4, 5. Make up all the permutations and then remove those that do not meet the conditions.

Exercise:

Count = 0

For x in range (1BI 6):

For y in range (1BI 6):

For z in range (1BI 6):

For k in range (1BI 6):

If x, y or y, z or x, z or x, k or, y, or, z, k:

Continue

Else:

Print (xpencil, ypencil, zmenk)

Count + = 1

Print ('d combinations' count)

Or

Count = 0

For x in range (1BI 6):

For y in range (1BI 6):

For z in range (1BI 6):

For k in range (1BI 6):

If x! = y and y! = z and x! = z and x! = k and y! = k and z! = k:

Print (xpencil, ypencil, zmenk)

Count + = 1

Print ('d combinations' count)

2 、

Topic: the bonus paid by the enterprise is based on the profit commission.

When the profit (I) is less than or equal to 100000 yuan, the bonus can be raised by 10%.

If the profit is more than 100000 yuan, when the profit is less than 200000 yuan, the part below 100000 yuan will be given 10% commission, and the part higher than 100000 yuan will be given 7.5% commission.

Between 200000 and 400000, there will be a 5% commission for the part higher than 200000 yuan, and 3% for the part higher than 400000 yuan between 400000 and 600000.

Between 600000 and 1 million, 1.5% is allowed for the portion above 600000 yuan, and 1% for the portion over 1 million yuan when it is higher than 1 million yuan.

Enter the monthly profit I from the keyboard and ask for the total amount of bonus?

Program analysis: please use the number axis to demarcate and locate. Note that the bonus should be defined as a growth integer.

Exercise:

Profit = input ("please enter the profit:")

I = int (profit)

Bonus = 0

If I

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report