Calculating Pi With Python For Pi Day

823
0
Published 2023-03-14
Youtube won't let me used angled brackets in the description for whatever reason, so I will comment the code and pin that comment.





#mathnerd #nerd #coolgraphs #coolmath #mathiscool #mathisfun #subscribe #subscriber #sub #youtube #youtuber #subscribers #youtubers #subscriberyoutube #subscribetomychannel #like #smallyoutubersupport #smallyoutubercommunity #smallyoutubers #newyoutuber #youtubechannel #smallyoutuberarmy #newyoutubers #subcribers #newyoutubercommunity #subs #subcribe #newyoutubevideo #trending #trendingvideo #shorts #trendingshorts

All Comments (5)
  • import math run = 1 totalruns = 100000 pisum=[] while(run <= totalruns): pi1 = (-1)**(run + 1) pi2 = pi1/((2*run)-1) pisum.append(pi2) percent = round((100*(run/totalruns)),3) print("[",run,"/",totalruns," Iterations Complete]---[",percent,"%"," Complete]") run = run + 1 if(run >= totalruns): pi = 4*sum(pisum) print("[π ≈ ",pi,"]")
  • print() takes time to actually print :) you can make it so that it only prints, say, every 100 iterations
  • @DefinedCmajor
    i dare you to make a code that calculates the formula for a ∆ both surface and around formula