In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article focuses on "introduction of python input functions and common operators". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn "introduction to python input functions and common operators".
Type conversion:
A=input ('Please enter an addition:')
A=int (a)
B=input ('Please enter another addition:')
B=int (b)
Print (type (a), type (b))
Print (aquib)
Run the script-shift+F10 is about to run
Normal operators in Python
Common operators:
1. Arithmetic operator:
[standard arithmetic operator
(addition, subtraction, multiplication, division + division (for example, print (1x 1), print (11max 2) results in 5.5 division; print (11prime 2) results in 5, you take an integer.
The result of the remainder operator (print (11% 2) is 1, and the remainder is taken; the power operator print (2 percent 2) represents the second power of 2, and the result is 4]
Integral division operation: when a positive and negative integer formula, take the whole down; all positive and negative according to the normal operation.
Print (9 racer 4) is 2.
Print (- 9 Universe 4) is 2.
Print is-3. The result of the operation is-2.2, and the carry down is-3.
The result of the print (- 9Compact 4) is-3. The result of the operation is-2.2, and the carry down is-3.
Take off operation:
Print (9% Mur4) # Formula: remainder = divisor-divisor * quotient, that is, 9-(- 4) * 3-9-12-- >-3
Print (- 9% 4) # Formula: remainder = divisor-divisor * quotient that is-9-4 * (- 3) =-9 Murray 12 =-9% 12
two。 Assignment operator
= order of execution: right-> left
Example:
Chain assignment is supported-> a=b=c=20
A=b=c=20
Print (a _ pen _ id (a))
Print (bjournal id (b))
Print (c _ journal id (c))
Parameter assignment is supported-- > + =,-=, * =, / =, / / =,% =
Print ('- support parameter assignment -')
Axi20
30 # equivalent to a=a+30
Print (a)-> 50
A murmur 10 # is equivalent to a=a-10
Print (a)-> 40
Astatine 2 # is equivalent to a=a*2
Print (a)-> 80
Print (type (a)) # is int
A Candle 3
Print (a)-> 26.666666666
Print (type (a)) # is folat
A pinprick 2
Print (a)-> 13.0
Print (type (a)) # is folat
A% room3
Print (a)-- > 1.0
Print (type (a)) # is folat
Support series unpack assignment-> a _
Print ('- support series unpacking assignment -')
A _
Print (a _
# a number of variables does not correspond to the number of numerical values.
Print ('- exchange the values of two variables -')
A recalcitrance baccalaureate 10
Print ('before swap:', aPermie b)
# the following is the code for the exchange
A _
Print ('after swap:', aMagneb)-> run the script
Before the exchange: 10 20
After exchange: 20 10
(the course is chapter P22)
3. Comparison operator
4. Boolean operator
5. Bit operator
At this point, I believe you have a deeper understanding of the "introduction of python input functions and common operators". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.