Python Basics

Chris Angelico rosuav at gmail.com
Fri Oct 3 19:05:50 EDT 2014


On Sat, Oct 4, 2014 at 8:54 AM, Seymore4Head
<Seymore4Head at hotmail.invalid> wrote:
>>Q2. Implement a function called printNumTriangle. The function should ask the user to enter a single integer. It should then print a triangle of that size specified by the integer so that each row in the triangle is made up of the integer displayed.
>>
>>The following is a sample output
>>
>>Please enter an integer for triangle size:
>>1
>>22
>>333
>>4444
>>55555
> for i in range(1,10):
>     print (str(i)*i)

Seymour, please don't do this. When you "help" someone by just giving
him the answer to a homework problem, you get him past his immediate
issue of "I need to submit my homework for this problem". That lets
him get through his course without understanding the code he's
creating (because he's not the one creating it). He'll either run into
more trouble before graduating the course, or (far worse) he'll
graduate successfully, without having the competence that the course
is supposed to teach - and the world will be given a qualified
programmer who doesn't know his stuff. That damages the world, damages
the reputation of the course, and gives python-list a reputation as a
homework assignment solver... none of which I want. I'm pretty sure
you don't want it either.

So don't do people's homework for them. PLEASE!!

ChrisA



More information about the Python-list mailing list