File name "triangleTest.py"
x = int (raw_input("Enter the edge of triangle: "))
edge = x + 1
i = '*'
for y in range(1,edge):
print (i * y).ljust(x), (i * (edge-y)).ljust(x)
print
for y in range(1,edge):
print (i * y).rjust(x), (i * (edge-y)).rjust(x)
Run:
Method 1
Typing "python " in your console to start python and then you can typing your code follow.
Method 2
Type "python triangleTest.py" will help you get the job done more quickly.
Result:
Wow, is this "cpu fan" ?
Have fun!!

0 意見:
Post a Comment