...

Back to Leadership Board

Challenge #5: Spiral Art

Start Date: Novemner 10, 2023
Submit By: 8:30 am on November 17, 2023

In this project, you will continue learning about both for and while loops, as well as Python functions, and how to use them to create amazing spiral art.
We will cover the following:

  •     Python functions
  •       For loops
  •       While loops
  •       Creating a spiral art using functions, for and while loops.
Watch a Video Tutorial

Video Tutorial

Challenge #5: Spiral Art

Your task is to create captivating spiral art using Python functions and loops. Here's how we're going to structure it:

Challenge Details:
  • Watch video instructions and learn about While and For loops
  • Create a new Trinket and set up the screen with a suitable background colour.
  • Divide the Screen: Start by dividing your canvas into four equal parts using horizontal and vertical lines.
  • #1 Square Spiral Art: In the first cell, you'll create a stunning spiral art pattern using squares. These squares should be generated using Python functions, and you're encouraged to add more elements if you can. Use of for/or while loop is mandatory.
  • #2 Combination Spiral Art: Moving to the second cell, combine triangles and circles or semi-circles to create a Spiral Art. You should use Python function to create the triangles, use of for or while loop is mandatory.
  • #3 and #4 Replicate the Provided Images: For the third and fourth cells,you'll be given images to replicate using for or while loops. This is a reverse engineering exercise - study the images, understand how they were created, and then use loops to recreate them. See images below:

Points: For this coding challenge, we will have slightly different points, and you will receive separate points for each of the four spiral art creations.
  • 5 points if you completely followed the instructions and ticked all the boxes of the spiral art.
  • 3 points if it's partially correct or completed.
  • 1 point if you've tried your best and attempted it

  • Too Hard? If this challenge feels too challenging, don't worry! Try your best to create your first two spiral arts or any other spiral arts. Give it your all in replicating the spiral arts from the provided pictures. Learn more about spiral art-> follow examples here

    Next
    For and While Loops

    Python has two primitive loop commands:

  • while loops
  • for loops
  • A for loop is used for iterating over a sequence or performing repetitive tasks. With the for loop, we can execute a set of statements, once for each item in a list or as many times as indicated.

    Example:

    Print each fruit in a fruit list:

    The range() Function

    To loop through a set of code a specified number of times, we can use the range() function

    This piece of code prints the same value 6 times

    The while Loop

    With the while loop we can execute a set of statements as long as a condition is True.

    Example:

    Print i as long as i is less than 6:
    Draw circles untill counter is less than 5

    Prev Next
    Spiral Art Examples

    Spiral art is all about the creative use of loops in programming to generate captivating patterns. By manipulating the position, size, and even color of the objects you're drawing in your art, you can produce a wide range of stunning and unique designs.

    Spiral Art Samples

    More Samples

    Follow the link for more Spiral Art Examples More Examples

    Prev Next
    Submit your Challenge

    Submit your final project





    Copy your Trinket Url

  • Click Share->Link
  • Copy the link to share your code
  • Paste link into the field

  • Do you have a question?



    Prev