September 30th, 2004, 06:06 PM
Java equivalent of this Python snippet?
I need to convert this to Java using multiple for loops.
lines = 15
stars = 1
spaces = lines - stars
while lines != 0:
print (" " * spaces) + ("*" * stars)
spaces = spaces - 1
stars = stars + 2
lines = lines - 1
Last edited by ryankask; September 30th, 2004 at 06:07 PM.
Reason: code tags
October 2nd, 2004, 06:33 PM
Depending on what you want the equivalent Java code for, you might want to look into Jython, an implementation of the Python Interpreter written in Java; that runs under the JVM. With Jython you can compile run the Python program above, and run it using your JVM:
If this isn't what you want you'd probably get a better responce if you reposted your question in the Java forum.
I hope this helps,
October 3rd, 2004, 09:49 AM
No, I needed it for a class but I've figured it out. Thanks.