In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
Python in how to operate Integer integer and Float floating-point, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can gain something.
First, create a new python file named py3_integer_float.py, and code the string manipulation in this file:
# define a variable and assign it to 3num = "use the type () function to view the type of num # the result is print (type (num)) # then assign the num to 3.3" and then print the object type num = 3.3 "and the result is print (type (num)) # basic arithmetic # addition: 3 + subtraction: 3-multiplication: 3 * Division: 3 / floor division: 3 / floor division The remainder of "exponentiation: 3 * *": 3% 2print (3 + 2) # 5print (3-2) # 1print (3 * 2) # 6print (3x2) # 1.5print (3 / / 2) # 1print (3 * * 2) # 9print (3% 2) # "about division 3ripple" runs in the python2 version and the result is the real result # the order of arithmetic operations # the basic principle is # multiply and divide first Add and subtract # the following example first calculates 3 times "add 1print (3 * 2 + 1) #" with the following modifications # if enclosed in parentheses # will first calculate the contents in parentheses # so the result is 9print (3 * (2 + 1)) # the number grows num = 1num = num + 1print (num) # "or + = way num = 1num + = 1print (num) # use * = num = 1num * = 5print (num) # built-in function # abs (): take absolute value print (abs (- 7)) # 7#round (): rounding count print (round (5.75)) # 6#round () keep decimal places print (round (5.75)) # 5." comparison operator # results return Boolean type value True/False# equals: 3 = "not equal to: 3! =" greater than: 3 > "< 3:
< 2#大于等于:3 >= less than or equal to: 3 2) # Trueprint (3
< 2)#Falseprint(3 >= 2) # Trueprint (3
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.