Skip to content

Commit 90d9f9f

Browse files
authored
Merge pull request #1 from nerdiumm/find_pi
Create + completed find_pi.py, Edited README
2 parents b8e5cba + 195d3c6 commit 90d9f9f

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,21 +28,31 @@ optimize and capitalize on what I and whoever else have and will learn.
2828
- [ ] **Coin Flip Simulator** - Write some code that simulates flipping a single coin however many times the user decides. The code should record the outcomes and count the number of tails and heads.
2929

3030
## TEXT
31+
- [ ]
3132

3233
## ALGORITHMS
34+
- [ ]
3335

3436
## DATA STRUCTURES
37+
- [ ]
3538

3639
## CLASSES
40+
- [ ]
3741

3842
## NETWORKING
43+
- [ ]
3944

4045
## FILES
46+
- [ ]
4147

4248
## DATABASES
49+
- [ ]
4350

4451
## WEB
52+
- [ ]
4553

4654
## GRAPHICS AND MULTIMEDIA
55+
- [ ]
4756

48-
## GAMES
57+
## GAMES
58+
- [ ]

find_pi.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# User enter a number. Generate PI up to that many decimal places.
2+
# REMEMBER THE LIMITS OF HOW FAR THE PROGRAM CAN GO!
3+
4+
import math
5+
6+
user_inp = input("How many decimals places would you like to see in PI? ")
7+
deci_places = int(user_inp)
8+
9+
# I stopped at the 49th decimal point because after this, Python just adds zeros
10+
# to the end of pi
11+
if (deci_places <= 48):
12+
str_format = "%." + user_inp + "f"
13+
print(str_format % math.pi)
14+
else:
15+
print("I cannot go that far out into PI.")

0 commit comments

Comments
 (0)