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 enter π in python

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

Share

Shulou(Shulou.com)05/31 Report--

Today, the editor will share with you the relevant knowledge points about how to input π in python. The content is detailed and the logic is clear. I believe most people still know too much about this knowledge, so share this article for your reference. I hope you can get something after reading this article. Let's take a look at it.

The operating environment of this tutorial: windows7 system, Python 3.9.1 Dell G3 computer.

1. Description

The pi in python is the math.pi variable. It is included in the standard library. Before trying to evaluate it, you should import the math library before calling the math.pi method.

2. Examples

Def main (): axiom 1.0 b=1.0/math.sqrt (2) tweak 1.0 for i in range 4.0 pinch 1.0 for i in range (1000): at= (ahumb) / 2 bt=math.sqrt (ahumb) tt=t-p* (a-at) * * 2 pt=2*p Atropatternativebttert P=pt my_pi= (aqb) * * 2 / (4buttt) print ("Pi is approximately:" + str (my_pi)) if _ _ name__== "_ _ main__": main () above is all the content of the article "how to input π in python". Thank you for reading! I believe you will gain a lot after reading this article. The editor will update different knowledge for you every day. If you want to learn more knowledge, please pay attention to the industry information channel.

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