Custom Search

Python Lessons

These 'lessons' are designed to help you follow me along the python trail.

They make use of an interactive python program - hosted by Trinket.

Trinket is a wonderful resource - it enables you to run the program and edit the coding and play with it on your computer.

 

 

I came across this site via the Open University - and I figured if they used it, it would be safe and as they endorsed it why shouldn't I!

 

Here are my lessons - if you look at them in the order I wrote them you will follow the same path as me - I begin as a total newbie to Python!

Lesson 1 Assignment of Variables If you are not sure what a variable is - see variable in the Glossary section. 21/09/2022
Lesson 2 Error Messages   22/09/2022
Lesson 3 if, else and elif Conditional statements to vary action according to the value of a variable 23/9/2022
Lesson 4 for.. in... Assigning variable values from a list for iteration by 'for... in...' 26/09/2022
Lesson 5 # Comments
Lesson 6 functions Access to a library of functions and how to write one yourself. 27/09/2022
Lesson 7 storing data Using lists
Lesson 8 input() User interaction with your program
Lesson 9 numbers Types of numbers 28/09/2022
Lesson 10 while Simple loop function 30/09/2022
Lesson 11 Exercise Euclid's greatest common divisor algorithm 01/10/2022
Lesson 12 Operators

Operators, operands and operations.

Lots of mathematical actions here!

Did the Arithmetical Operators, the Relational or Comparison Operators, the Assignment Operators and the Bitwise Operators

03/10/2022
Lesson 13 Rounding float numbers Using round() and specifying a number of decimal places
Lesson 14 Significant figures  
Lesson 15 maths functions

Click here to see the thinking process behind a program I have written. I take you through step by step.

The program solves GCSE level quadratic equations.

15/10/2022
Lesson 16 Operators Did Identity and Logical today - only one to go!
Lesson 17 Turtles

Great fun getting a turtle to draw a cube.

I also did a page on turtle commands.

16/10/2022
Lesson 18

I made a page explaining how 'turtles' came about.

Then I made a program to draw an equilaterally sided figure of the choice of the user.

17/10/2022
Lesson 19

Incorporated code that directed the user to choose only an integer in a specific range.

19/10/22
Lesson 20

A Halloween Greeting - a witch turtle drawing pentacles on a spooky castle background.

While doing this I set up a page on colour.

20/10/22
Lesson 21

Great fun writing a program that will draw any number of points on a star.

There are three methods to make it work...

Odd number of points:

Even points, that halve to an even number (e.g. 8):

Even points that halve to an odd number (e.g. 14):

I also learnt how to change the position of the cursor with an address command rather than steering it there.

22/10/2022
Lesson 22

As a biproduct of the star program I have written a program that draws a 'flower' with petalsthat are 'kite shaped'.

The user chooses the number of 'petals'.

I added to the colour page - explaining how figures can be filled with colour.

I also started a page on circles.

24/10/2022
Lesson 23

A pumpkin Halloween Greeting.

26/10/2022
Lesson 24

Today I added to the circles page - making it easier to understand.

I also found out how to make an 'oval shape' - an ellipse.

I also discovered how to define a method - rather like creating a subroutine in Basic - orientate the turtle in one simple command, and make the turtle return home - turtle.home().

27/10/2022
Lesson 25  

Today I thought of Remembrance Day - and did a tribute to the fallen...

This includes a method for drawing the poppy - therefore calling on that would be possible with alternate sizes and orientation. Something for tomorrow maybe...

28/10/2022
Lesson 26

This is a tribute to my Aunt - I received the sad news that she would soon 'pass' today...

17/12/2022
Lesson 27 18/12/2022
Lesson 28 19/12/2022
Lesson 29 20/12/2022