Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import msvcrt
- import numpy as np
- import matplotlib.pyplot as plt
- import time
- def nuc(u, n):
- if u >= n:
- u -= n
- n *= 3
- else:
- n += u * 3
- u = 0
- return u, n
- u = int(input())
- n = 0
- timer = 1
- unranium_data = [u]
- neutrons_data = [n]
- while u > 0:
- ch = 'not_x'
- if msvcrt.kbhit():
- ch = msvcrt.getch()
- kek = 0
- if ch == b'x':
- n += 1
- u, n = nuc(u, n)
- unranium_data.append(u)
- neutrons_data.append(n)
- timer += 1
- time.sleep(0.3)
- plt.plot([i for i in range(timer)], unranium_data)
- plt.plot([i for i in range(timer)], neutrons_data)
- plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement