Python Logic & Patterns
Patterns train your loops. Puzzles train your logic. Draw each shape on paper first, then write the code.
40 questions in 3 phases · Learn first: chapters 8 to 15 of the course
0 of 40 solved
1Warm-up
Simple shapes made with one or two loops. Every question gives you the steps.
- 1Python Program to Print a Square of Stars#270Easy
- 2Python Program to Print a Number Triangle#271Easy
- 3Python Program to Print a Row-Number Triangle#272Easy
- 4Python Program to Print an Upside-Down Star Triangle#273Easy
- 5Python Program to Print a Right-Aligned Star Triangle#274Easy
- 6Python Program to Print a Hollow Square#275Easy
- 7Python Program to Print a Letter Triangle#276Easy
- 8Python Program to Print Letter Rows#277Easy
- 9Python Program to Print a Chessboard Pattern#278Easy
- 10Python Program to Print Floyd's Triangle#279Easy
- 11Python Program to Print a 0 and 1 Triangle#280Easy
- 12Python Program to Print a Countdown Number Triangle#281Easy
- 13Python Program to Print a Plus Sign of Stars#282Easy
- 14Python Program to Print a Name Banner in a Box#283Easy
2Practice
Pyramids, diamonds and number tricks. Count the spaces carefully.
- 15Python Program to Print a Star Pyramid#284Medium
- 16Python Program to Print an Upside-Down Star Pyramid#285Medium
- 17Python Program to Print a Diamond of Stars#286Medium
- 18Python Program to Print a Hollow Triangle#287Medium
- 19Python Program to Print a Palindrome Number Pyramid#288Medium
- 20Python Program to Print Pascal's Triangle#289Medium
- 21Python Program to Print an Hourglass of Stars#290Medium
- 22Python Program to Print a Butterfly Pattern#291Medium
- 23Python Program to Print an X Pattern#292Medium
- 24Python Program to Find the Digital Root of a Number#293Medium
- 25Python Program to Check If a Number Is a Strong Number#294Medium
- 26Python Program to Check If a Number Is a Happy Number#295Medium
- 27Python Program to Turn a Number into Binary by Hand#296Medium
- 28Python Program to Find the Next Palindrome Number#297Medium
3Challenge
Puzzles that need careful thinking. Try small examples on paper first.
- 29Python Program to Print a Hollow Diamond#298Hard
- 30Python Program to Print a Zigzag Pattern#299Hard
- 31Python Program to Print a Number Spiral#300Hard
- 32Python Program to Find Twin Primes in a Range#301Hard
- 33Python Program to Count the Steps of Kaprekar's Routine#302Hard
- 34Python Program to Check a Magic Square#303Hard
- 35Python Program to Print the Moves of the Tower of Hanoi#304Hard
- 36Python Program to Write a Number in Words#305Hard
- 37Python Program to Check a Sudoku Grid#306Hard
- 38Python Program to Print the Look-and-Say Sequence#307Hard
- 39Python Program to Play One Step of the Game of Life#308Hard
- 40Python Program to Find the Angle Between Clock Hands#309Hard