triangles yo
This commit is contained in:
parent
688da0ac83
commit
1e293e5904
@ -1,19 +1,17 @@
|
|||||||
####Print a Triangle
|
Print a Triangle
|
||||||
|
================
|
||||||
##Using nested for loops, print a triangle like so:
|
|
||||||
|
|
||||||
`*`
|
|
||||||
`**`
|
|
||||||
`***`
|
|
||||||
`****`
|
|
||||||
`*****`
|
|
||||||
`******`
|
|
||||||
`*******`
|
|
||||||
`********`
|
|
||||||
`*********`
|
|
||||||
`**********`
|
|
||||||
|
|
||||||
This triangle is 10 high, but I want the ability to make it as high as I want by setting one variable.
|
|
||||||
|
|
||||||
You can print this to the console or to the printout div.
|
|
||||||
|
|
||||||
|
Using nested for loops, print a triangle like so:
|
||||||
|
```
|
||||||
|
>>> triangle(10)
|
||||||
|
*
|
||||||
|
**
|
||||||
|
***
|
||||||
|
****
|
||||||
|
*****
|
||||||
|
******
|
||||||
|
*******
|
||||||
|
********
|
||||||
|
*********
|
||||||
|
**********
|
||||||
|
```
|
||||||
|
1
python/5-triangles-part-1/triangle.py
Normal file
1
python/5-triangles-part-1/triangle.py
Normal file
@ -0,0 +1 @@
|
|||||||
|
def triangle(num):
|
Loading…
x
Reference in New Issue
Block a user