how to lag python

Solutions on MaxInterview for how to lag python by the best coders in the world

showing results for - "how to lag python"
Liana
25 Jun 2018
1Evil! Anyway...
2
3print(9**9) is easily manageable for python. On a faily fast computer, it will 
4only take a few milliseconds for the output to appear: 387420489. Check it 
5against a calculator. Not bad. So let's punish our interpreter properly.
6
7print(9**9*9) Nope. Still fast.
8
9print(9**9*99) is still blisteringly fast. 
10
11print(9**9*9*9*9*9*9*99**9) ... at which point, you realize that it's too much 
12of a waste of your time. Python is just TOO fast. Even getting it to count on 
13and on until it gets to infinity, or until your device puts itself out of use, 
14probably won't actually LAG it. So let's get Mr Top-of-the-Class to calculate 
15pi.
16
17
18
19
20
21from __future__ import division
22import math
23from decimal import Decimal as D
24from decimal import getcontext
25
26getcontext().prec = 400
27MAX = 10000
28pi = D(0)
29
30for k in range(MAX):
31    pi += D(math.pow(16, -k)) * (D(4/(8*k+1)) - D(2/(8*k+4)) - D(1/(8*k+5)) - D(1/(8*k+6)))
32
33print('Pi is' , pi)
34
35
36Wait, it's still not lagging. Typical.
37
38Conclusion: Python IS  incredibally fast and efficient. So really, throwing
39your computer outside may be the best option.