|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Java equivalent of this Python snippet?
I need to convert this to Java using multiple for loops.
Code:
lines = 15
stars = 1
spaces = lines - stars
while lines != 0:
print (" " * spaces) + ("*" * stars)
spaces = spaces - 1
stars = stars + 2
lines = lines - 1
Thanks. Last edited by ryankask : September 30th, 2004 at 07:07 PM. Reason: code tags |
|
#2
|
||||
|
||||
|
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:
www.jython.org 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, Mark. |
|
#3
|
|||
|
|||
|
No, I needed it for a class but I've figured it out. Thanks.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > Java equivalent of this Python snippet? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|