More results...

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

Astronomy Challenge

constellation

What is a constellation?


In astronomy a constellation is a grouping of stars on the celestial sphere perceived as a figure or design. There are 88 recognized constellations and each of these have been named after characters from classical Greek and Roman mythology as well as various common animals and objects.

Python Challenge


In this challenge we are using Python Turtle to draw famous constellations on the screen.

Each constellation is saved as a list. Each value of the list represents a star. Each star is also a list with only 2 values, the x and y coordinates of the star (drawn on a 2D screen). So a constellation is stored as a list of lists!

For instance, for Cassiopeia:

cassiopeia = [[-90,70],[-50,-10],[0,0],[40,-50],[100,0]]

Using a for loop we can then read the content of the constellation, to plot each star on the screen, one at a time, based on its x and y coordinates.
constellations

x,y Coordinates?


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


Check the following code:

Your Task


Complete the following code by adding one more constellation of your choice.

You will find the pattern of the most famous constellations on this website.

sagittarius

unlock-access

Solution...

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

Escape Flowcharts

In this challenge you will be asked to solve four mazes by designing their matching escape flowcharts. You can download and print this pdf booklet to draw your flowcharts.

Maze #1: The Staircase


The first maze has already been solved for you:maze-flowchart-2

The escape flowchart for this maze is already done for you:
maze-flowchart-1

Maze #2: The ladder


maze-flowchart-3
Design the flowchart to escape this maze.

Maze #3: The spiral


maze-flowchart-4
Design the flowchart to escape this maze.

Maze #4: The expanding staircase


maze-flowchart-5
Design the flowchart to escape this maze.

Tagged with:

Python Turtle – My House

house-python-turtleUsing Python Turtle we created a range of functions to draw a house.

We use these functions in our main program but can’t seem to get it to work. We believe the code has all the required instructions but these are being processed in the wrong order.

Did you know?


When running a program, the computer follows your instructions one line at a time, in the same order as these instructions appear in your program. This is called sequencing.

sequencing-label

To fix this code you may have to reorder the lines of code in the correct order/sequence.

Also one of the windows seems to appear in the wrong position. It seems to be an issue with the parameters being used with the drawWindow() function.

Can you re-organise this code to recreate the picture of a house as above.

Extension Task #1


Add another cloud on the left hand side of the picture, partling covering up the sun.
house-2-python-turtle

Extension Task #2


Convert all the windows to round windows except the middle window to become square.
house-3-python-turtle

Extension Task #3


Color the front door in light blue instead of red.
house-4-python-turtle

Extension Task #4


Add a chimney on the roof of the house. To do so you will need to write a new function called drawChimney() in the shapes.py tab.
house-5-python-turtle

Tagged with: , ,

HTML – Website Add-Ons

You have now completed a fully working website. You have added a few webpages and created a fully working navigation system. All your pages have some meaningful and relevant content including pictures and text.

What’s Next?


This blog post will give you some ideas of add-ons you could add to your website to improve the look & feel of the site, add live content or add some interactivity to your webpages.

Using an online Text Editor
Using an online Text Editor can save you a lot of time to create HTML code for your main text.
Google Fonts
Bored with the usual Arial or Times New Roman fonts? Choose amongst a collection of hundreds of Google Fonts that can be used on any webpages.

Check the video tutorial on how to use Google Fonts on your website: https://youtu.be/peR9V-f9OkI

You will need to add the following code in the <HEAD> section of your code:

<link href="http://fonts.googleapis.com/css?family=YOUR_CHOSEN_FONT" rel="stylesheet" type="text/css">

And then in HTML your code either use the

<FONT face="YOUR_CHOSEN_FONT">...</FONT>

Or in CSS:

BODY, H1, P  {
   font-family: YOUR_CHOSEN_FONT;
}
Table of Data
Use this website to create a table of data such as a price list or a table showing opening times for the different days of the week.
Transition Effects
Use these examples to create a transition effects that will run when you page loads or is being refreshed.
Interactive Slide Show
Check this page to create a fully interactive slideshow showing images and slideshow navigation features.
Interactive image Gallery
Check this page to create a fully interactive image gallery showing image thumbnails and gallery navigation features.
Roll Over Buttons
Create some nice rollover buttons to add to your website or to create a navigation bar.
Responsive Navigation Bar
Create a fully responsive navigation bar which will adapt to the size of the screen and work great on smartphones.
Google Maps Widget
A google map widget could be a good add-on to your contact us page or your directions page. Find the map you want to focus on and embed it on your webpage.

Check the video tutorial on how to embed a Google map: https://youtu.be/BsvieSBad5Q

Live Weather Forecast Widget
Check this website that lets you add a live weather forecast widget to your webpage in just a few click. You can specify the format of your widget as well as the location for which you need the weather forecast.
Google Translate
Check this website that lets you add a Google translate widget to your website. However this will only works on live websites!

HTML / CSS – Transition Effects

In this blog post we will investigate how to create transition effects.

This effect will occur when you load or refresh a web page. It makes the navigation through a webpage more interactive and user friendly. Transition effects are drawing the attention of the user to let them know their page has been loaded.

Fading Transition Effect

See the Pen CSS Transition Effects by 101 Computing (@101Computing) on CodePen.

Press the rerun button in the bottom right corner to preview this animation

Sliding Transition Effect

See the Pen CSS Transition Effects – Sliding Effect by 101 Computing (@101Computing) on CodePen.

Press the rerun button in the bottom right corner to preview this animation

Rotate Transition Effect

See the Pen CSS Transition Effects – Rotate by 101 Computing (@101Computing) on CodePen.

Press the rerun button in the bottom right corner to preview this animation

Zoom-In Transition Effect

See the Pen CSS Transition Effects – Scale Effect by 101 Computing (@101Computing) on CodePen.

Press the rerun button in the bottom right corner to preview this animation

HTML – Adding Webpages & Hyperlinks

In this video tutorial we investigate how to add more webpages to our website and how to create the hyperlinks for the navigation bar using the anchor tag <A>

html-anchor-tag

Video Tutorial


HTML – External CSS Stylesheet

Did you know?


You can use CSS code both within your HTML page or as a separate CSS file

Internal CSS Stylesheet


Internal CSS is saved wihtin the HTML page by adding a <STYLE> tag inside the <HEAD> section of the page.

The example below is an example of internal CSS stylesheet:

<HTML>
<HEAD>
    <STYLE>
         BODY { 
             background-color: #00FFFF;
         }
    </STYLE>
</HEAD>
<BODY>
   ....
</BODY>
</HTML>

The issue with internal CSS stylesheet is when a website consists of many HTNL pages. The CSS code needs to be added to every single page which can be really time consuming to maintain.

External CSS Style Sheet


To solve this issue, we can save the CSS code in a single file with the file extension .css (for instance: style.css)

We can then link all the pages of our website to this CSS stylesheet by adding the following code to our pages:

<HTML>
<HEAD>
    <link rel="stylesheet" type="text/css" href="css/style.css">
</HEAD>
<BODY>
   ....
</BODY>
</HTML>

The main benefit of this approach is that we can now change the look & feel of all the webpages of our website by changing the content of just one single style.css file.
external-css-stylesheet

Video Tutorial


Tagged with: ,

Hogwarts Sorting Hat Challenge

hogwarts-sorting-hatIn the Harry Potter series of novels written by British author J. K. Rowling, The Sorting Hat is a magical hat at Hogwarts that determines which of the four school Houses each new student belongs most to. These four Houses are Gryffindor, Hufflepuff, Ravenclaw, and Slytherin.

In this challenge we are going to write Python program to control the sorting hat.

Your Task


Check the flowchart below and use Python to code your program.

flowchart-sorting-hat

Video Tutorial


Python 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: ,

Voting Age Checker – Flowchart

For this challenge you are going to code a script to ask a user how old they are and inform them as to whether they are old enough to vote or not. If they are not old enough to vote, the script will calculate how many years the user will have to wait before being allowed to vote.

Flowchart


flowchart-voting-age-checker

Task #1


Recreate this flowchart by writing the pseudo-code of this algorithm using code2flow.com.

Task #2


Implement this code using our online Python IDE:

Task #3


Test your code. Is it behaving the way you would expect? What input data could you use to test your code?

Test # Input Values Expected Output Actual Output
#1 Age: 21 You can vote
#2 Age: 16 You will be able to vote in 2 years.
#3 Age: 100 You can vote.
#4 Age: 0 You will be able to vote in 18 years.
#5 Age: 18 You can vote
#6 Age: (leave blank) Error Message
#7 Age: “I am fifteen years old” Error Message

Task #4: Improve your code


How could you improve your code to fix some of the errors you have spotted by completing your test plan? What validation routines could you add to this code to make it more robust?
unlock-access

Solution...

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

Pizza Robot – Flowchart

In this blog post we will design our own algorithms using both pseudo-code and flowcharts.

When given a problem to solve using a computer program you need to think about?

  • What are the main steps required to solve this program? (decomposition)
  • In which order will these steps be processed? (sequencing)
  • What information do I need to retrieve from the end user? (inputs)
  • What information do I need to display to the end user? (outputs)
  • What decisions will the computer need to make? (selection / if statements)
  • Is there any part of the process that can be repeated several times? (iteration / loops)

Then you can design your algorithm either in “plain English” (e.g. using pseudo-code) or using a visual representation (flowchart).

Scenario: Coffee Machine

Let’s look at the algorithm used in a tea/coffee machine.
The machine should:

  • Ask the user whether they want tea or coffee,
  • Add the tea or the coffee to the cup,
  • Ask the user whether they want milk,
  • If so, add milk to the cup,
  • Ask the user whether they want sugar,
  • If so, add sugar to the cup,
  • Pour the hot water into the cup.

Now let’s look at this algorithm using pseudo-code and using a flowchart:

Pseudo-codeFlowchart

START;

/Would you like Tea or Coffee?/;

if tea {
  Add Tea in cup;
} else {
  Add Coffee in cup;
}

/Would you like Milk?/;

if Milk {
  Add Milk in cup;
}

/Would you like Sugar?/;

if Sugar {
  Add Sugar in cup;
}

Pour hot water in cup;

END;
flowchart-coffee-machine

Your Task: Pizza Robot


Adapt the above algorithm to use it in a pizza robot. Here is what the robot should do:

  • Welcome the user,
  • Ask what pizza base they need? (Thin, Thick)
  • Ask if they want tomato sauce or BBQ sauce?
  • Ask if they want cheese or not?
  • Cook the pizza for 20 minutes,
  • Serve the pizza

Extension:

  1. Ask if the user is vegetarian. If they are not, then ask if they want chicken on their pizza.
  2. The cooking time of the pizza varies: It should be 15 minutes for a thin base and 20 minutes for a thick base. Adapt your flowchart accordingly.

Create your pseudo-code and your flowchart using code2flow.com. Note you can reuse the code form the coffee machine to help you get started!
code2flow

Tagged with:
Privacy Overview

This website will store some information about your preferences on your own computer inside a tiny file called a cookie. A cookie is a small piece of data that a website asks your browser to store on your computer or mobile device. The cookie allows the website to remember your actions or preferences over time.

You can delete all cookies that are already on your computer, and you can set most browsers to prevent them from being placed. However, if you do this, you may have to manually adjust some preferences every time you visit a site, and some services and functionalities may not work.

Most browsers support cookies, but you can set your browser to decline them and can delete them whenever you like. You can find instructions here for how you can do that on various browsers.

This website uses cookies to:

  1. Identify you as a returning user and to count your visits in traffic statistics analysis
  2. Remember your custom display preferences (such as light/dark theme option)
  3. Provide other usability features, including tracking whether you have already given your consent to cookies

Enabling cookies is not strictly necessary for the website to work but it will provide you with a better browsing experience.

The cookie-related information is not used to identify you personally and is not used for any purpose other than those described here.

There may also be other types of cookies created after you have visited this website. This site uses Google Analytics, a popular web analytics service that uses cookies to help to analyse how users use the site. The information generated by the cookie about your use of this website (including your IP address) will be transmitted to and stored by Google on servers in the United States. Google will use this information for the purpose of evaluating your use of other website, compiling reports on website activity, and providing other services relating to website activity and internet usage. Google may also transfer this information to third parties where required to do so by law, or where such third parties process the information on Google’s behalf. Google undertakes not to associate your IP address with any other data held by Google.