...

Code Crafted TextArt

As part of this project you will learn:

What is computer programming (coding)?

Computer programming, also known as coding, is the process of designing, writing, and instructing a computer to perform specific tasks or solve problems. It involves creating a set of instructions, called code, using a Programming Language that the computer can understand and execute.

We will learn a text-based programming language called Python.

Why Python?

  • It's perfect for beginners.
  • It's easy to setup.
  • It's powerful
  • It's can be used for graphics, animations, web applications, games, etc.
  • What is Trinket?

    During our Coding Classes, we will be using Trinket. Trinket is an online version of code editor where students can write and run their code online. Trinket is available online at trinket.io.

    Students may create a free account to save all the projects-> click here, and note that parental permission is required to create accounts for children under 13.

    IMPORTANT!: It's important to understand that Trinket creates public web pages and projects that anyone with a link can view. Young people may need a reminder about the importance of not sharing personal information online.

    Python Syntax

    Python has a simple syntax similar to the English language. Understanding the basic symbols in programming is important. We will frequently come across these symbols in our coding classes.


    Prev Next
    Please ensure all required fields are filled in
    Step 1: Saying hello
  • Open the blank Python template trinket: Open New.
  • Type the following into the window that appears:
  • The line #!/bin/python3 just tells Trinket that we're using Python 3 (the latest version).
  • Click Run, and you should see that the print() command prints everything between the quote marks ''.
  • If you've made a mistake, you'll get an error message telling you what went wrong instead!
  • Try it! Delete the end quote ' or the closing bracket ) (or both) and see what happens.
  • Prev Next
    Please ensure all required fields are filled in
    Step 2: Enter your name

    The input() allows you to input information into the program. Let's ask to enter the name. Type the following code into the next line:

    Click Run, this piece of code will ask you to enter your name. Enter your name.

    Variables

    Your name will be stored in the code in the variable called name. Variables are containers for storing data values.

    Prev Next
    Please ensure all required fields are filled in
    Step 3: Print your name back

    Now our program knows your name, so let's print it out. Type the next line of code as shown in the picture:

    After you run the code you will be able to see that program printed out a greeting to you.

    Prev Next
    Please ensure all required fields are filled in
    Step 4: Let's create some art

    Now let's create some pictures using text symbols, type the following code:

    In Python, using the r'''...''' syntax is known as a "raw string" or "raw string literal." It's commonly used when working with strings that contain backslashes (\)

    In Python, \n is a special escape sequence that represents a newline character. It is used within strings to indicate the end of a line and instructs the text to move to the next line when printed or displayed.

    After you run the code you will be able to see that program printed out our pictures

    Prev Next
    Please ensure all required fields are filled in
    Step 5: Save your work

  • If you don't have a Trinket account, click the down arrow and then click Link. This will give you a link that you can save and come back to later. Or Click Email to send this project to your email address.
  • You'll need to do this every time you make changes, as the link will change!
  • If you have a Trinket account, you can click Remix to save your own copy of the trinket.
  • Prev Next
    Please ensure all required fields are filled in
    Step 6: Challenge

    Create your own artwork using symbols:

  • Use one of the sample pictures or create your own!
  • Prev Next
    Please ensure all required fields are filled in
    Step 7: Complete and Share

    Submit your final project



    Copy your Trinket Url

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