Dear All,
or improve my understanding o python I would like to learn how to draw simple
figures using loops.
I start from this code in java:
import java.util.Scanner;

public class Eserc2_8 {
    public static void main(String args[]) {
        Scanner s = new Scanner(System.in);
        // Altezza del triangolo
        int altezza = s.nextInt();
       
        for (int riga = 1; riga <= altezza; riga++) {
            int i = 0;
            while (i<altezza-riga) {
                System.out.print(" ");
                i += 1;
            }
            i = 0;
            while (i< (riga*2)-1) {
                System.out.print("*");
                i += 1;
            }
            System.out.println("");
        }
    }
}

and I want to transfer to python loops:

for i in range(10):
    #space
    for t in range(6-i):
        print ""
        for item in range(i+1):
            print "."


But I ha not succed. So someone could you please explain how can work'
thanks  a lot
bw



_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to