More results...

Generic selectors
Exact matches only
Search in title
Search in content
Post Type Selectors
post
page
Python IDE Dashboard

Turtle Spirals

Before comleting this challenge you may want to recap on our previous two challenges:

In this challenge we are using iteration to repeat a number of instructions over and over.

Square Based Spiral #1:

Square Based Spiral #2:

Spider Web:

Your Challenge:


Tweak any of these trinkets to make your own spiral effect. Try to reproduce some of these:
spirals

Python Turtle – Iteration

Let’s Recap

In our previous challenge, we looked at using sequencing to write a program using Python Turtle to complete a drawing.

Remember when using Python Turtle, the most useful instrcutions are as follows:

  • myPen.color(“red”)
  • myPen.forward(100)
  • myPen.right(90)
  • myPen.left(45)
  • myPen.penup()
  • myPen.pendown()
  • myPen.goto(0,0)
  • myPen.circle(50)

Learning Objectives:


In this challenge we are going to use for loops to repeat a set of instructions many times. This is called iteration.

We are also going to look at nested loops. (A loop within a loop)

Challenge:


By using a loop you can repeat a set of instructions many times. This is called iteration.
Look at the following scripts: Can you create your own script using iteration?

Iteration Example 1: (Star)

Iteration Example 2: (Flower)

Iteration Example 3: (Using nested loops)

Python Turtle – Sequence

Looking at the following code can you explain the purpose of each Python Turtle instruction:

  • myPen.color(“red”)
  • myPen.forward(100)
  • myPen.right(90)
  • myPen.left(45)
  • myPen.penup()
  • myPen.pendown()
  • myPen.goto(0,0)
  • myPen.circle(50)

X and Y coordinates? Quadrant?


xy-coordinates
Check the above picture. Can you state three facts about X and Y coordinates and about quadrants?

The canvas we are drawing on (using Python Turtle) is 400 pixels wide by 400 pixels high.
Look at the canvas below to understand how (x,y) coordinates work:

Python Code


Challenge #1: Sequencing


Writing a program that consists of a linear list of instructions written in a specific order is called sequencing.

Your Challenge

Use all of the instructions mentionned above to complete a drawing of your choice.
PythonTurtleChallenge

Challenge #2: Iteration


By using a loop you can repeat a set of instructions many times. This is called iteration.
Check the following challenge to create complex drawing using iteration.

Tagged with: ,

Weather Forecast Report

weather-forecastThis challenge consists of using Python to generate a random weather forecast report.

Learning Objectives:

By investigating this challenge you are going to further improve your skills at:

  • Using lists and accessing values of a list randomly,
  • Concatenating strings together to create a longer string.

What’s a list?


In Python, a list is used to save collection of values. For instance, to save a list of world cities we could declare a variable called “worldCities” and assign a list as follows:

worldCities = ["London", "Sao Paulo", "New-York", "Beijing", "Paris", "Cairo", "Dehli"]

Based on this what do you think len(worldCities) would return?
What’s about worldCities[0]?
Or worldCities[3] ?

Let’s get started!


We have started the weather forecast report for you. You will need to complete this code to provide a full weather forecast report describing:

  • What type of sky to expect: clear blue, cloudy, dark grey, etc.
  • What type of precipitations to expect: light rain, heavy snow, hail storm, fog, etc.
  • The predicted strength in mph and direction of the wind,
  • etc.

weather

Challenge #2


Create two lists of keywords, one for hot weather (e.g. hot=[“dry weather”, “hot air”, “strong sun”]) and one for cold weather (e.g. cold=[“ice on the road”,”chances of snow”, “icy wind”]).
Adapt your code to check where the temperature is high or low:

  • If your temperature is above a certain threshold add some hot weather information to your report.
  • If your temperature is below a certain threshold add some cold weather information to your report.
Tagged with:

Python Fractals

Sierpinski-triangle-ani

Fractal?


A fractal is a curve or geometrical figure, which is based on a recurring pattern that repeats itself indefinitely at progressively smaller scales. Fractals are useful in modelling some structures (such as snowflakes), and in describing partly random or chaotic phenomena such as crystal growth and galaxy formation.

Find out more about fractals: http://en.wikipedia.org/wiki/Fractal

In this challenge we will be looking at two well-known fractals both named after the Polish mathematician Wacław Sierpiński:

  • Sierpiński Triangle
  • Sierpiński Carpet

Sierpiński Triangle

The following figures show how the pattern of this fractal:
Sierpinski_triangle

Your Challenge: Sierpiński Carpet

The following figures show how the pattern of this fractal:
Sierpinski carpet
Your challenge consists of recreating this fractal by completing the following code:

unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area
Tagged with: , , ,

Haiku Generator in Python

haiku

Did you know?

A Haiku is a Japanese short poem consisting of three lines traditionally evoking images of the natural world. There are specific rules when writing a Haiku e.g. number of syllables in each line, however, to keep it simple we are not going to worry too much about these rules for now.

Learning Objectives:

By investigating this challenge you are going to further improve your skills at:

  • Using lists and accessing values of a list randomly,
  • Concatenating strings together to create a longer string.

Our Haiku Generator


Check the code below to generate a random Haiku:

Road Signs in HTML / CSS

road-sign-speed-limit-50In this set of challenges we are going to use CSS to recreate various road signs.

Learning Objectives

By completing these challenges you will learn more about how CSS can be used to format information on the page.
We will be looking at:

  • How to add borders, and border radius to create a rounded corner text frame.
  • How to add a shadow to the text frame.
  • How to add a gradient effect to our text frame

Challenge #1

The first challenge consists of recreating this number plate using CSS:NumberPlate

Check the following code to see how the border was created using both the border and the border-radius CSS definitions. You can also investigate how the shadow was created using the box-shadow CSS definition.

See the Pen Post-it notes by 101 Computing (@101Computing) on CodePen.

Challenge #2

For this challenge we are using exactly the same CSS definitions. By increasing the border-radius we are creating the round shape.

See the Pen Number Plate by 101 Computing (@101Computing) on CodePen.

Challenge #3

Try to recreate these road signs using CSS:

road-sign-M25

road-sign-30
road-sign

roas-sign-taxi

road-sign-green

road-sign-zone-30

 

road-sign-traffic-lights

Extension Task: Using Gradients

To create the gradient we recommend using an online CSS gradient generator which will create the CSS code for you: e.g. http://www.colorzilla.com/gradient-editor/

See the Pen Number Plate by 101 Computing (@101Computing) on CodePen.

Further Reading…


Should you want to learn more about CSS, the next concept that you should focus on is the different types of selectors that can be used in CSS.

Tagged with: ,

Pixel Art Gallery

Check our Pixel Art Challenge – Art work from our students:

Scroll down to see the gallery…
arrow_down_pixel



















































PixelArt_Ghost_dd9670d466 PixelArt_Mario_216c6d0a6a PixelArt_2b01f6b788
View Python Code
View Python Code
View Python Code
PixelArt_5b26c70afc pixelArt_0ce7de68b6 pixelArt_d11ac32928
View Python Code
View Python Code
View Python Code
pixelArt_d65d0d37c2 pixelArt_4b7127cedd pixelArt_5a16cb5925
View Python Code
View Python Code
View Python Code
pixelArt_1805e7d3bd
pixelArt_7fb4331a10 pixelArt_4f6dcb932a
View Python Code
View Python Code
View Python Code
pixelArt_45adb463c5 pixelArt_c46051053d
View Python Code
View Python Code

Number Plate Generator

NumberPlate

For this Python challenge we need to investigate how UK number plates work. Check this page from aa.com to learn more about the current format of number plates in the UK.

Learning Objectives:

By completing this challenge using Python we are going to learn how to use ASCII code when manipulating strings.

You will use the chr() and ord() python instructions to convert characters into ASCII code and vice versa.
For instance:

  • print(chr(65)) would display the letter “A” on screen as 65 is the ASCII code for character “A”.
  • print(ord(“A”)) would display the 65 on screen as 65 is the ASCII code for character “A”.

To complete this challenge you may want to use our ASCII code helpsheet

Challenge #1: Random Number Plate Generator

Your first challenge consists of creating a program that generate a random plate number each time it is run.

The plate number will have to adhere to this format:
2 UPPER CASE LETTERS followed by 2 digits (0 to 9) followed by a space followed by 3 UPPER CASE LETTERS

To help you we have started the code to generate a random uppercase letter. You can now complete this code to generate the full plate number.

Challenge #2: Number Plate Validator

Your second challenge consists of writing a program that will ask the user to enter a number plate. The program will then confirm whether the number plate is valid or not.

Remember, a valid number plate has to follow this format:
2 UPPER CASE LETTERS followed by 2 digits (0 to 9) followed by a space followed by 3 UPPER CASE LETTERS

unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area
Tagged with: ,

Drawing Flowcharts…

Recommended Online Software: draw.io

What do you think the following flowchart would be used for?
Password Validation