Python Basics

diarmuid.higgins at mycit.ie diarmuid.higgins at mycit.ie
Fri Oct 3 13:54:32 EDT 2014


On Friday, October 3, 2014 6:47:54 PM UTC+1, Chris Angelico wrote:
> On Sat, Oct 4, 2014 at 3:44 AM,  <diarmuid.higgins at mycit.ie> wrote:
> 
> > def printNumTriangle():
> 
> >    num = input("Please enter an integer for triangle size:")
> 
> >    for i in range(1,num+1):
> 
> >       for j in range (i):
> 
> >          print i
> 
> >
> 
> > Cheers!!!!
> 
> 
> 
> Okay! You're very close, and I can see what's going on there. But I'd
> 
> like you to learn how to ask questions, as well as how to write Python
> 
> code, because both skills are important to your future. :) So I'm
> 
> going to get you to take another step in asking the question: What is
> 
> it that your code isn't doing right?
> 
> 
> 
> ChrisA

Hi Chris
I can't get the code to display the output as it should.
I can get it to display like this:
122333444455555 or I can get it to display like this:
1
2
2
3
3
3
4
4
4
4
5
5
5
5
5
but not as has been asked in the question.
Cheers
Diarmuid



More information about the Python-list mailing list