logo CodeStepByStep logo


Language/Type: Python for

Write a function named floyds_triangle that accepts an integer k as a parameter and prints a k-row version of Floyd's triangle. Floyd's triangle is a sequence of increasing numbers, starting with 1, where each Nth row of numbers displays the next N numbers in the sequence. For example, the call of floyds_triangle(5); should print the following console output:

2 3
4 5 6
7 8 9 10
11 12 13 14 15

If k is 0 or negative, print no output.

Function: Write a Python function as described, not a complete program.

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.