Created
March 4, 2016 02:22
-
-
Save Kwisses/db8c0888a63e9e2b9825 to your computer and use it in GitHub Desktop.
[Daily Challenge #6 - Easy] - Pi to 30 Decimals? - r/DailyProgrammer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ***** 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) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
[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/