Showing posts with label browser-based-Python. Show all posts
Showing posts with label browser-based-Python. Show all posts

Wednesday, April 24, 2013

Plot me some randomness


By Vasudev Ram

In this recent post about plot.ly,

plot.ly, fast plotting in the browser,

I mentioned that plotting by pasting data worked, but plotting using Python had an issue, and that they said they were fixing it.

The plot.ly people got back to me saying that the Python issue is fixed.

I tried it out again with a couple of simple plotting examples involving random numbers. They worked.

Here are the examples:

from numpy import *
from random import randint

x = range(1, 10)
y = [ random.randint(1, 10) for i in x ]
plot(x, y)

from numpy import *
from random import randint

x = range(1, 20)
y = [ random.randint(1, 10) for i in x ]
plot(x, y)

(The only difference in the above two scripts is 10 vs 20.)

You can try out that code, or your own, in plot.ly.

Go to https://plot.ly/plot.

Click on the "tab" labeled "+" near the top left of the screen, then click "Script" from the drop-down menu.

Enter your script (no need to Save) and then click Run.

If your code has no errors, your plot will appear in a new tab (not a new browser tab, but a new "tab" within the plot.ly browser tab).

The plot may take 2 to 3 seconds to appear.

plot.ly is beta software, but looks useful. They have many more complex examples in their demos.


- Vasudev Ram - Dancing Bison Enterprises


Friday, April 5, 2013

PythonMonk - learn Python in the browser

PythonMonk - Interactive Python tutorials

PythonMonk is an online browser-based tool to learn Python, created by C42 Engineering.

Can't try it out right now because I am on my mobile, but will check it later today and update this post with initial impressions.

Update: I tried out the first page of lessons on PythonMonk (on a PC) and it worked fine.

A couple of observations:

- It supports the Python use of docstrings in a function as tests. It runs the tests and checks if they succeed or fail.

- The lesson runs include mildly amusing Zennish comments, like from a master to a student :-)

Also check my earlier posts about other tools roughly similar to PythonMonk:

repl.it, an online REPL for many languages

and

codepad.org, executable multi-language pastebin, in Python

There's a Hacker News thread about Python Monk.


I also tried out this code that one HN reader (on that thread) did:

__import__("os").execv("/usr/bin/uname", ["uname", "-a"])
and got about the same result as them:
Linux ip-10-166-37-168 2.6.32-amazon-xen-r3 #1 SMP Mon Jan 16 21:03:16 PST 2012 i686 GNU/Linux
, from which it looks like PythonMonk is running on AWS (Amazon Web Services).

- Vasudev Ram
dancingbison.com