Print Pyramid, half pyramid, inverted pyramid | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 2

Print Pyramid, half pyramid, inverted pyramid

Assignment in school

7th Dec 2022, 6:25 AM
intuyous
1 Answer
+ 7
intuyous Try to code yourself using this hint..since it is your assignment 1>>>take user input for number of lines you need in pyramid.. 2>>>you should use for loop upto the range of your input...if you are printing asterisks pyramid one for loop is enough.. this for loop denotes rows of your pyramid..if you need to print number pyramid two for loops needed.. Let for asterisks pyramid , 3>>>the print statement should contain (number of lines - no. Of rows) multiplied by asterisk For number pyramid.. You should use two for loops.. Outer for loop ranges upto your input Inner for loop range should be (no. of lines - no.of rows) Then use print statement to print appropriate pattern
7th Dec 2022, 7:32 AM
Riya
Riya - avatar