This Python lesson includes over 35+ coding programs for printing Numbers, Pyramids, Stars, triangles, Diamonds, and alphabet patterns, ensuring you gain hands-on experience and confidence in your Python skills.
Printing numbers, stars (asterisk), or other characters in different shapes (patterns) is a frequently asked interview question for freshers. Creating these number and pyramid patterns allows you to test your logical ability and coding skills.
In this lesson, you’ll learn how to print patterns using the for loop, while loop, and the range() function.
This article teaches you how to print the following patterns in Python.
- Number pattern
- Pyramid pattern
- Inverted pyramid pattern
- Half pyramid pattern
- Triangle pattern
- Star (*) or asterisk pattern
- Diamond Shaped pattern
- Characters or alphabet pattern
- Square pattern