Plotted you see all the numbers for the first draw (ball) of all Megamillions ever played in Europe since Fri Feb 13, 2004 to Tue Apr 25, 2023. Do you see any pattern there? No, you can't. The reason is that these numbers are all random.
1 import sys
2 import matplotlib.pyplot as plt
3
4 numbers = []
5 for token in sys.stdin.read().split(','):
6 try:
7 numbers.append(int(token.strip()))
8 except ValueError:
9 # ignore tokens that can't be converted to integers
10 pass
11
12 # Create a new figure and axis object
13 fig, ax = plt.subplots()
14
15 # Set the title of the plot
16 ax.set_title("Input Numbers")
17
18 # Set the labels for the X and Y axis
19 ax.set_xlabel("Position")
20 ax.set_ylabel("Number")
21
22 # Plot the numbers as a line chart
23 ax.plot(numbers)
24
25 # Show the plot
26 plt.show()
27
28 # Save the plot
29 plt.savefig('plot.png')
No comments:
Post a Comment