How to print perfect triangle of numbers 1 to 100 ? | Sololearn: Learn to code for FREE!

+1

How to print perfect triangle of numbers 1 to 100 ?

Python pattern printing

5/19/2022 2:52:29 PM

alagammai uma

16 Answers

New Answer

0

https://code.sololearn.com/c8QGBx9fBoJZ/?ref=app Just set your size

+3

I don't understand yet how the numbers should be arranged but you might want to do something like that? https://techpluslifestyle.com/technology/triangle-shape-in-python/

+2

alagammai uma printing to 101 might be too big for small screens and would result in line breaks. also, use this: for i in range(1, 5): row = str(i)+" " print(" "*(5-i)+row*(i))

+1

alagammai uma It looks like you're being a bit too vague in your programming. Like right now, you're only telling the computer to print out numbers with a space at the end and beginning.

+1

By "perfect triangle" do you mean a) equilateral triangle b) triangle with perimeter equal to its area? Please give an example

+1

@lisa equilateral

+1

Lisa pattern needed is of the method 2&3 combination in the link u have sent

+1

Method 2&3 of which section? You can use the given code and adjust it to your needs

+1

OkLisa thank you

+1

OkBob_Li ok

0

By using a loop for example. What have you tried so far?

0

I tried using 2 loops from 1 to 100 range but it isn't the correct pattern what's needed

0

Lisa https://code.sololearn.com/c2zb4kBHxSDK/?ref=app kindly c this

0

Justice I am beginner to python and I am trying to learn

0

0

James thank you