Anonymous
Anonymous asked in Computers & InternetProgramming & Design · 1 month ago

Which online compiler can run this code?

import numpy

import matplotlib.pyplot as plt

x = numpy.random.normal(5.0, 1.0, 1000)

y = numpy.random.normal(10.0, 2.0, 1000)

plt.scatter(x, y)

plt.show()

Update:

Unable to init server: Could not connect: Connection refused

Unable to init server: Could not connect: Connection refused

(prog:12965): Gdk-CRITICAL **: 05:29:05.403: gdk_cursor_new_for_display: assertion 'GDK_IS_DISPLAY (display)' failed

(prog:12965): Gdk-CRITICAL **: 05:29:05.417: gdk_cursor_new_for_display: assertion 'GDK_IS_DISPLAY (display)' failed

2 Answers

Relevance
  • Anonymous
    1 month ago
    Favourite answer

    The problem looks like you're not running an X server, or you're running it as a different user. 

    This online one seems to work, although it's a bit slow:

    https://repl.it/languages/python3

  • 1 month ago

    Any computer can run the code

Still have questions? Get answers by asking now.