Skip to content

alexandertorkelsen/CalculatePi

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

CalculatePi

Calculate pi with a monte carlo method

To run:

python get_pi.py

Requires PyGame

Issues

  • The calculation starts from scratch for each iteration, which makes each iteration take more time than the last.
  • There is a lot of jitter in the estimation, due to starting from scratch each time

Task

Convert calculate_pi() to an iterator or generator, and modify the code accordingly

Hints

  • The "while True" loop can be replaced by an iterable
  • The calculation needs some minor changes to work as an iterator/generator
  • The "for _ in range(iterations)" loop may not be necessary

About

Calculate pi with a monte carlo method

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%