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

Basic knowledge of python 04 basic knowledge of mathematics

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

Share

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

The basic knowledge of three numbers in the course

Python console can be executed as a calculator to perform arithmetic such as [root@flink-slave5] # ipythonPython 3.7.4 (default, Aug 13 2019, 20:35:49) Type 'copyright',' credits' or 'license' for more informationIPython 7.8.0-- An enhanced Interactive Python in the python console. Type'?' For help.In [1]: 2 + 3 Out [1]: 5In [2]: 2 + 3 * 2 Out [2]: 8 supports addition, subtraction, multiplication and division. Focus on the division because except for some special * (base) C:\ Users\ Administrator > pythonPython 3.7.3 (default) Mar 27 2019, 17:13:21) [MSC v.1915 64 bit (AMD64)]:: Anaconda, Inc. On win32Type "help", "copyright" "credits" or "license" for more information. > > 2 + 3 * 517 > 5.3/22.65In [1]: 5 / 2 Out [1]: 2.5In [2]: 5 / / 2 Out [2]: 2In [3]: 4 / 2 Out [3]: 2.0In [4]: 4 / / 2 Out [4]: 2 Out / Division (/) both numerator and denominator results in floating-point numbers The characteristic of the first knowledge point positive division operator (/ /) py is that it only takes the integer part > 5Compact 22 > 4Compact 22 > / if the integer is divisible (both the numerator and denominator are integers), then the result is an integer if only one of the numerators and denominators is a floating point number, but the result is floating point number > > 5.2pm 22.0. Note: in py, only integer and floating point power operators (* *) > the third power of integer and floating point operators (%) / / the remainder (%) / / can be taken from both integers and floating point numbers > 5Compact 22.5 > 5% 21 > 5.2%21.2000000000000002python supports / / +-* /% / * * ()-3 / / represents the symbol in negative 3python. Parentheses second exponentiation third sign (-) fourth * / /% fifth +-example: # coding:utf-8print (2 + 4) print (12654) print (20 + 4 * 5) print ((20 + 4) * 5) print (4x2) print (4Univer 2) print (3Univer 2) print (3lap2) print (5. 2) print (5.2) print (4) print (3 + 2 *-3 * * 3-- 3 * * 2) x = 4y = 5l = 2.4print (x + y * l) / / the result is 6-528401202.0211.562.0256-4216.0

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