Lesson 2 Variables and Lists.

Slides:



Advertisements
Similar presentations
Positive Gradient the s_ _ _ _ ness of the slope and the direction – UP (SW to NE)
Advertisements

CS144: Spatial Index. Example Dataset Grid File (2 points per bucket)
How to represent numbers using “quick hundreds” “quick tens” and “quick ones” Unit 3 Math Expressions.
EQUIVALENT FRACTIONS GOAL I can make equivalent fractions with like denominators.
 graphic organizers in the form of illustrations or images displayed in sequence for the purpose of pre-visualizing a motion picture, animation, motion.
1.3.3 Distributive Property Task SWBAT: 1) Use distributive property to simplify expressions and write equivalent expressions.
Happy Sad Angry Calm. Things that made me feel happy today Things that made me feel sad today.
Variables When programming it is often necessary to store a value for use later on in the program. A variable is a label given to a location in memory.
BBC Microbit Getting set up and making your first program.
For Loop GCSE Computer Science – Python. For Loop The for loop iterates over the items in a sequence, which can be a string or a list (we will discuss.
Mathsercise-C Graphs 1 Ready? Here we go!. Graphs 1 Complete this grid for the function y = 3x x y Answer Question 2 Substitute each.
Creating your own Handheld Games Console
Lesson 1 Sequencing.
BBC MICRO:BIT Lesson 2 Variables and Lists. Variables When programming it is often necessary to store a value for use later on in the program. A variable.
Lesson 4 Accelerometer.
Lesson 5 Music.
Hex: a Game of Connecting Faces. Player 1 Player 2 Players take turns placing blue chips (player 1) and red chips (player 2). Player 1 plays first. Player.
1 Introduction to Coding. 2 Example Codes A lot of example codes are given with Arduino IDE A code can often be based on a previous example rather than.
GCSE COMPUTER SCIENCE Practical Programming using Python
Sequencing Learning Objective: to be able to design algorithms that use sequencing.
Bbc microbit Lesson 3 – Temperature hot medium.
Computer Science A-level
Lesson 1 - Sequencing.
Lesson 1 An Introduction
Module 2 Lesson 2 Reflections Reflections.
Cross Multiplication. 4x + 16 = ……………...
@TeacherToolkit, license CC BY-NC-ND 3.0
Carbon: Transformations in Matter and Energy
Lesson 4 – Glowing pendulum
Lines, Arrows, & WordArt Experiment with the line, arrow, and WordArt buttons on the Drawing toolbar.
Objective of the lesson
String Manipulation.
Iteration and Selection
BBC Microbit.
BBC Microbit.
BBC Microbit.
micro:bit for primary schools – mb4ps.co.uk
LearnZillion Notes: --This is your hook. Start with a question to draw the student in. We want that student saying, “huh, how do you do X?” Try to be specific.
DRAW ME A PICTURE OF lac operon when it’s “turned off”
Python Lesson 3 Mr. Kalmes.
Sequencing Learning Objective: to be able to design algorithms that use sequencing.
BBC Microbit.
micro:bit: External Inputs & Outputs
Game Controller Lesson Three.
Lesson 4 Accelerometer.
02/12/2018 Angles.
BBC Microbit.
BBC Microbit.
BBC Microbit.
BBC Microbit.
BBC Microbit.
DRAW ME A PICTURE OF trp operon when it’s “turned off”
Do you want to draw more than one heart?
Getting Started with Physical Computing
Lesson 2.
Make Ten Example: Name: ______________________
micro:bit for primary schools – mb4ps.co.uk
Iteration Learning Objective: to be able to design algorithms that use iteration.
BBC Microbit.
3-1 Graphing and Writing Inequalities Warm Up Lesson Presentation
Python 3 Mr. Husch.
Errors.
One of these things is not like the other
One of these things is not like the other
One of these things is not like the other
Iteration Learning Objective: to be able to design algorithms that use iteration.
3-1 Graphing and Writing Inequalities Warm Up Lesson Presentation
Learning Objective: to be able to design programs that use iteration.
Computer Science A-level
Cross Multiplying Fractions.
Presentation transcript:

Lesson 2 Variables and Lists

Variables When programming it is often necessary to store a value for use later on in the program. A variable is a label given to a location in memory containing a value that can be accessed or changed. Think of a variable as a box with a label that you can store information in. Name

Drawing Your Own Images Each LED pixel on the micro:bit display can to set to one of ten values (0 to 9). 0 is off and 9 is the brightest setting. This program creates a checkerboard image and stores it in a variable called pattern. It then displays the image on the LED display. Try it for yourself.

Activity 2.1 Design your own image that you could display on the micro:bit by shading in the cells in the grid. Turn your design into a form the micro:bit will understand by placing a number between 0 and 9 in each cell.

Place a screenshot of your code here. Activity 2.2 Create a program that will display the image you designed in Activity 2.1. Use the code shown below as a starting point: Place a screenshot of your code here.

Place a screenshot of your code here. Activity 2.3 Define two more custom images and display them with a pause between each one. Use this code as a starting point: Place a screenshot of your code here.

Lists Lists in Python allow you to store multiple items, for example images. If you store a set of images in a list you can tell Micro Python to animate the list. This example program uses a list to store the happy, sad and angry images. It them animates them with a delay of 0.1 seconds between each image. Try it yourself.

Built In Images Here is a list of the built in images in Micro Python: Image.HEART Image.HEART_SMALL Image.HAPPY Image.SMILE Image.SAD Image.CONFUSED Image.ANGRY Image.ASLEEP Image.SURPRISED Image.SILLY Image.FABULOUS Image.MEH Image.YES Image.NO Image.TRIANGLE Image.TRIANGLE_LEFT Image.CHESSBOARD Image.DIAMOND Image.DIAMOND_SMALL Image.SQUARE Image.SQUARE_SMALL Image.RABBIT Image.COW Image.MUSIC_CROTCHET Image.MUSIC_QUAVER Image.MUSIC_QUAVERS Image.PITCHFORK Image.XMAS Image.PACMAN Image.TARGET Image.TSHIRT Image.ROLLERSKATE Image.DUCK Image.HOUSE Image.TORTOISE Image.BUTTERFLY Image.STICKFIGURE Image.GHOST Image.SWORD Image.GIRAFFE Image.SKULL Image.UMBRELLA Image.SNAKE Image.CLOCK12 # clock at 12 o' clock Image.ARROW_N ... # arrows pointing N, NE, E, SE, S, SW, W, NW (microbit.Image.ARROW_direction)

Place a screenshot of your code here. Activity 2.4 Create an animation using the different built in images. Use a list to store the images you want to use. Place a screenshot of your code here.

Place a screenshot of your code here. Activity 2.5 Define three new custom images and store them in a list. Create an animation using the list. Use this code as a starting point: Place a screenshot of your code here.