Highest Common Factors – Euclid's algorithm

Step 2 – input the two numbers

In the first part of the program we need to get the user to enter two numbers.

Scratch code image

Start by opening Python.

  1. Make sure that you go File > New File to get a blank Python program
  2. Getting two numbers entered is quicker in Python, but make sure you type the code accurately. It's easy to miss a bracket off the end

    I'm giving you this code as it's slightly tricky

    Note that my two variables are called number1 and number2

  3. Save your program
  4. Run your program

Code helper image

Now that we have the two numbers, the main bit of the program comes next.