Skip to content

Instantly share code, notes, and snippets.

@Kwisses
Created March 4, 2016 02:22
Show Gist options
  • Save Kwisses/db8c0888a63e9e2b9825 to your computer and use it in GitHub Desktop.
Save Kwisses/db8c0888a63e9e2b9825 to your computer and use it in GitHub Desktop.
[Daily Challenge #6 - Easy] - Pi to 30 Decimals? - r/DailyProgrammer
# ***** DAILY CHALLENGE #6 - EASY *****
# You're challenge for today is to create a program that can calculate pi accurately to at least 30 decimal places.
# Try not to cheat :)
# ---------------------------------------------------------------------------------------------------------------------
# Is this cheating?
import math
def calc_pi():
"""Prints pi to 30 decimals. """
pi = format(math.pi, '.31g')
return pi
pi_30 = calc_pi()
print(pi_30)
@Kwisses
Copy link
Author

Kwisses commented Mar 4, 2016

[Daily Challenge #6 - Easy] from the DailyProgrammer subreddit. Pi to 30 Decimals?. Might be cheating...

Reference: https://www.reddit.com/r/dailyprogrammer/comments/pp53w/2142012_challenge_6_easy/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment