ASCII Art. Introduction: Python

Similar documents
Quiz. Introduction: Python. In this project, you ll make a quiz game to challenge your friends. Activity Checklist.

Getting Started. Excerpted from Hello World! Computer Programming for Kids and Other Beginners

Hello World! Computer Programming for Kids and Other Beginners. Chapter 1. by Warren Sande and Carter Sande. Copyright 2009 Manning Publications

PYTHON YEAR 10 RESOURCE. Practical 01: Printing to the Shell KS3. Integrated Development Environment

Lesson 4: Who Goes There?

Text Input and Conditionals

In this project, you ll learn how to create your own webpage to tell a story, joke or poem. Think about the story you want to tell.

Exercise 6 - Addressing a Message

Intro. Scheme Basics. scm> 5 5. scm>

Excel Basics: Working with Spreadsheets

Getting Started With Linux and Fortran Part 2

CSS Crash Course for Fearless Bloggers by Gill Andrews

: Intro Programming for Scientists and Engineers Assignment 1: Turtle Graphics

CMSC 201 Spring 2017 Lab 01 Hello World

Math Day 2 Programming: How to make computers do math for you

USE QUICK ASSIST TO REMOTELY TROUBLESHOOT A FRIEND S COMPUTER

T H E I N T E R A C T I V E S H E L L

In this project, you ll learn how to use a turtle to draw awesome shapes and patterns.

COPYRIGHTED MATERIAL. Dipping Your Toe into Python. Part I. Chapter 1: Programming Basics and Strings. Chapter 2: Numbers and Operators

Introduction to Programming with JES

A computer program is a set of instructions that causes a computer to perform some kind of action. It isn t the physical parts of a computer like the

Decisions, Decisions. Testing, testing C H A P T E R 7

CMSC 201 Fall 2016 Lab 09 Advanced Debugging

Using IDLE for

How Your First Program Works

CS 1110, LAB 1: PYTHON EXPRESSIONS.

OrbBasic Lesson 1 Goto and Variables: Student Guide

Introduction to Programming

BCH339N Systems Biology/Bioinformatics Spring 2018 Marcotte A Python programming primer

[ the academy_of_code] Senior Beginners

OrbBasic 1: Student Guide

Have the students look at the editor on their computers. Refer to overhead projector as necessary.

CS354 gdb Tutorial Written by Chris Feilbach

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming

How to Open a Free Yahoo! Account & Basics

Session Booklet Social Media & Facebook

Lab 4: Bash Scripting

Exploring Python Basics

PAIRS AND LISTS 6. GEORGE WANG Department of Electrical Engineering and Computer Sciences University of California, Berkeley

Accounts and Passwords

PowerPoint Basics: Create a Photo Slide Show

Exploring Python Basics

CMSC 201 Spring 2018 Lab 01 Hello World

Lesson 2. Introducing Apps. In this lesson, you ll unlock the true power of your computer by learning to use apps!

How To Upload Your Newsletter

Lecture 1. basic Python programs, defining functions

Lab Assignment 1 Introduction to Programming ICS 31 & CSE 41 Summer Session

Welcome Back! Without further delay, let s get started! First Things First. If you haven t done it already, download Turbo Lister from ebay.

Hello, World! An Easy Intro to Python & Programming. Jack Rosenthal

Welcome to Computers for ESL Students, 4th Edition

The name of our class will be Yo. Type that in where it says Class Name. Don t hit the OK button yet.

Programming for Kids

LOOPS. Repetition using the while statement

Making a PowerPoint Accessible

Your . A setup guide. Last updated March 7, Kingsford Avenue, Glasgow G44 3EU

1.7 Limit of a Function

Using GitHub to Share with SparkFun a

Keep Track of Your Passwords Easily

5 R1 The one green in the same place so either of these could be green.

STEPS TO REGISTERING FOR OUR ONLINE AUCTIONS:

ECS Baruch Lab 3 Spring 2019 Name

Python lab session 1

Creating a new form with check boxes, drop-down list boxes, and text box fill-ins. Customizing each of the three form fields.

You will be writing code in the Python programming language, which you may have learnt in the Python module.

6.S189 Homework 1. What to turn in. Exercise 1.1 Installing Python. Exercise 1.2 Hello, world!

One of the hardest things you have to do is to keep track of three kinds of commands when writing and running computer programs. Those commands are:

SCRATCH MODULE 3: NUMBER CONVERSIONS

CS1046 Lab 4. Timing: This lab should take you 85 to 130 minutes. Objectives: By the end of this lab you should be able to:

On the Web sun.com/aboutsun/comm_invest STAROFFICE 8 DRAW

BB4W. KS3 Programming Workbook INTRODUCTION TO. BBC BASIC for Windows. Name: Class:

Using Functions in Alice

Lab 4: Shell Scripting

Emergency safety apps: which one is right for me?

CoderDojo Activity Cards: The Cards (Animation2.html): How to use: Student comes to mentor, and together they choose a card to do next.

Invent Your Own Computer Games with Python

SAFE Home Inventory. Getting Started Guide

Lost in Space. Introduction. Step 1: Animating a spaceship. Activity Checklist. You are going to learn how to program your own animation!

GCSE Computer Science Component 02

Hello! ios Development

Lost in Space. Introduction. Scratch. You are going to learn how to program your own animation! Activity Checklist.

Using Images in FF&EZ within a Citrix Environment

Exact layout for a high-converting landing page

Yup, left blank on purpose. You can use it to draw whatever you want :-)

MA 1128: Lecture 02 1/22/2018

Getting ready for L A TEX. Alexis Dimitriadis. Version: March 28, 2013

Introduction to 3D computer modeling

If Statements, For Loops, Functions

Game keystrokes or Calculates how fast and moves a cartoon Joystick movements how far to move a cartoon figure on screen figure on screen

Grade 6 Math Circles November 6 & Relations, Functions, and Morphisms

CMSC 201 Computer Science I for Majors

How To Get Your Word Document. Ready For Your Editor

Programming Fundamentals and Python

HDR/MDR Software Installation Detailed Instructions

CSCI 1100L: Topics in Computing Lab Lab 11: Programming with Scratch

Table of Laplace Transforms

WYBCS Android Programming (with AppInventor) Family fun day

Interactive Tourist Map

pset4: Sudoku October 2, 2011 pset4: Sudoku Tommy MacWilliam Distro Code ncurses Cursor Inputting Numbers Move Legality

AO3. 1. Load Flash. 2. Under Create New click on Flash document a blank screen should appear:

Programming for Beginners

Transcription:

Python 1 ASCII Art All Code Clubs must be registered. Registered clubs appear on the map at codeclub.org.uk - if your club is not on the map then visit jumpto.cc/18cplpy to find out what to do. Introduction: Python allows you to turn a series of instructions into useful programs and fun games! In this project you ll learn how to run a Python program, and how to print text to the screen. Activity Checklist Test your Project Save your Project Follow these INSTRUCTIONS one by one Click on the green flag to TEST your code Make sure to SAVE your work now 1

Step 1: Saying hello Activity Checklist 1. Let s start by writing a very simple program, just so that you know how to get a Python program running. Open the IDLE program editor: On Windows, find IDLE in the start menu; On Mac, open up Terminal.app and type idle and press enter; On Linux, open up a Terminal, and type idle and press enter. 2. Click File New Window, and type the following into the window that appears: print("hello, how are you?") This program will print some text to the screen. Notice that the text you want to print is surrounded by speech marks ( " ). Here s an image showing what you need to do: 3. Save the file, by clicking File Save, and name the file 2

hello.py or something similar. Don t forget to type the.py bit at the end, which tells the computer that it s a Python file. Without it, your program won t be colour coded, which can be really helpful. 4. Run the file by clicking Run Run Module. You should see another window appear, which is the Python shell. This is the place that your program will run. If everything has worked properly, you should see your text printed to the screen. 5. If you ve made a mistake, for example missing out a speech 3

mark ( " ), then you ll get an error message instead, telling you what went wrong! Try it! 6. Congratulations, you are now officially a Python programmer! Give yourself a pat on the back (or if you re feeling lazy, get someone else to do it for you). Challenge: What s on your mind? Change the program above to print something more interesting to the screen! 4

Step 2: About yourself Activity Checklist 1. Let s print something much more fun than text ASCII art! ASCII art is creating pictures out of text. Here s an example - it s meant to be a dog! To make this masterpiece, you can type the following into the IDLE editor and run the program: print("a picture of a dog...") print(" 0 ") print(" ") 2. If you prefer, you can use 3 single quotes ( ''' ) instead of speech marks, which allows you to print multiple lines of text with 1 print statement. Like this: print(''' A picture of a dog... 0 ''') If you run this program, you ll see it prints the same dog as before. 5

Challenge: About yourself Write a Python program to tell others about yourself, by using text and ASCII art. You can create images of your hobbies, friends, family anything you want! Here s an example: Step 3: Calculating text Activity Checklist 1. Python can also do calculations using text! What do you get if you multiply "hello" by 5? Let s ask Python, by running this program: print("hello" * 5) 6

The star * in the program above is a multiply sign. Run the program above, and you should see the answer: 2. You can make the printed text above easier to read, by putting a space after the word "hello" in your program: print("hello " * 5) Run this program and you ll see that the output is a little easier to read than before. 3. If "hello " multiplied by 5 is "hello hello hello hello hello ", then what is "hello" - 7? Does this calculation even make sense? 7

Oops, you ve broken it! Instead of an answer, we get an error message. It looks like that calculation doesn t make sense in Python! 4. How about addition? What answer do you think "hello " + "world " would give? Try it out, by running the following program: print("hello " + "world") 8

Does it give you the answer you expected? Challenge: Words and numbers What does the following program print to the screen? See if you can guess correctly before running the program. print("ha "*4) print("ba" + "na"*2) print("he" + "l"*2 + "o" + "!"*10) Can you make up any words of your own? Step 4: ASCII patterns Activity Checklist 1. Now that you know how to do calculations on text, now what? Why is it useful? Well, let s say you wanted to draw an ASCII art rectangle that is 30 characters long and 3 characters high. You could either draw it the hard way, like this: print("##############################") print("##############################") print("##############################") 9

Or you could save time and draw it the easy way, like this: print("#" * 30) print("#" * 30) print("#" * 30) Both give you exactly the same rectangle printed to the screen: 2. You could even use calculations to make interesting patterns, like this wave: print("/\ "*10) print(" \/"*10) 10

Challenge: Code a scarf Your best friend is having an 11th birthday party, and as a gift you ve decided to code them a scarf! Use calculations wherever possible to make your own scarf pattern. If you re feeling generous, you could even code them a cake (including 11 candles) to go with it! 11