livepython.net

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.

  1. 1Python Program to Print a Square of Stars#270
  2. 2Python Program to Print a Number Triangle#271
  3. 3Python Program to Print a Row-Number Triangle#272
  4. 4Python Program to Print an Upside-Down Star Triangle#273
  5. 5Python Program to Print a Right-Aligned Star Triangle#274
  6. 6Python Program to Print a Hollow Square#275
  7. 7Python Program to Print a Letter Triangle#276
  8. 8Python Program to Print Letter Rows#277
  9. 9Python Program to Print a Chessboard Pattern#278
  10. 10Python Program to Print Floyd's Triangle#279
  11. 11Python Program to Print a 0 and 1 Triangle#280
  12. 12Python Program to Print a Countdown Number Triangle#281
  13. 13Python Program to Print a Plus Sign of Stars#282
  14. 14Python Program to Print a Name Banner in a Box#283

2Practice

Pyramids, diamonds and number tricks. Count the spaces carefully.

  1. 15Python Program to Print a Star Pyramid#284
  2. 16Python Program to Print an Upside-Down Star Pyramid#285
  3. 17Python Program to Print a Diamond of Stars#286
  4. 18Python Program to Print a Hollow Triangle#287
  5. 19Python Program to Print a Palindrome Number Pyramid#288
  6. 20Python Program to Print Pascal's Triangle#289
  7. 21Python Program to Print an Hourglass of Stars#290
  8. 22Python Program to Print a Butterfly Pattern#291
  9. 23Python Program to Print an X Pattern#292
  10. 24Python Program to Find the Digital Root of a Number#293
  11. 25Python Program to Check If a Number Is a Strong Number#294
  12. 26Python Program to Check If a Number Is a Happy Number#295
  13. 27Python Program to Turn a Number into Binary by Hand#296
  14. 28Python Program to Find the Next Palindrome Number#297

3Challenge

Puzzles that need careful thinking. Try small examples on paper first.

  1. 29Python Program to Print a Hollow Diamond#298
  2. 30Python Program to Print a Zigzag Pattern#299
  3. 31Python Program to Print a Number Spiral#300
  4. 32Python Program to Find Twin Primes in a Range#301
  5. 33Python Program to Count the Steps of Kaprekar's Routine#302
  6. 34Python Program to Check a Magic Square#303
  7. 35Python Program to Print the Moves of the Tower of Hanoi#304
  8. 36Python Program to Write a Number in Words#305
  9. 37Python Program to Check a Sudoku Grid#306
  10. 38Python Program to Print the Look-and-Say Sequence#307
  11. 39Python Program to Play One Step of the Game of Life#308
  12. 40Python Program to Find the Angle Between Clock Hands#309