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

How to use assignment operator in Python

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

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

Python how to use the assignment operator, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.

Code implementation

A = 10print ('1, a =', a) a = a + 5print ('2, a =', a) a + = 5print ('3, a =', a) a-= 5print ('4, a =', a) a * = 5print ('5, a =', a) a * * = 2print ('6, a =', a) a / = 25print ('7, a =', a) a = 25.0# when performing arithmetic operations on floating point numbers The result also returns a floating point number print ('8, a =', a) a / / = 5print ('9, a =', a) a = 5print ('10, a =', a) a% = 4print ('11, a =', a)

Code run output:

1. A = 10

2. A = 15

3. A = 20

4. A = 15

5. A = 75

6. A = 5625

7, a = 225.0

8, a = 25.0

9, a = 5.0

10, a = 5

11, a = 1

Program analysis

# in this example, the main example is the assignment operator, which can be found in any program, which is very basic knowledge, and there are many forms to follow, but there are also rules to follow. This part lists some of the main forms. Please practice more in your daily study and work.

# = you can assign the value to the right of the equal sign to the variable to the left of the equal sign

# + = a + = 5 equals a = a + 5

#-= a-= 5 is equivalent to a = a-5

# * = a * = 5 equals a = a * 5

# * = a * * = 5 equals a = a * * 5

# / = a / = 5 is equivalent to a = a / 5

# / / = a / / = 5 is equivalent to a = a / / 5

#% = a% = 5 equals a = a% 5

Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.

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

Internet Technology

Wechat

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

12
Report