Learning areas/Python for Beginners

Python track

Python for Beginners

Learn Python from zero: tiny steps, easy words, 20 Beginner, 20 Intermediate and 20 Advanced questions.

Learn in this order

Start at step 1. Each idea prepares you for the next one.

0/10
  1. 1Show words on screen with print
  2. 2Store values in variables
  3. 3Keep many values in a list
  4. 4Make choices with if and else
  5. 5Repeat work with loops
  6. 6Build reusable functions
  7. 7Use dictionaries for rows of data
  8. 8Write short list comprehensions
  9. 9Handle mistakes with try and except
  10. 10Use classes, modules and pandas

Continue where you left off

Beginner 1: Say hello

60 questions remaining in this sector

Resume →
Industry context

Your datasets, exercises and portfolio outputs stay inside the sector you choose.

Beginner · Strings & Indexing

15 exercises — finish them all to earn a certificate

0/15 done
15 questions left to earn this certificate
  1. Beginner 1: Say hello
  2. Beginner 2: Do a sum
  3. Beginner 3: A box called a variable
  4. Beginner 4: A word box
  5. Beginner 5: Join words
  6. Beginner 6: Fill in the blanks
  7. Beginner 7: What type is it?
  8. Beginner 8: Turn text into a number
  9. Beginner 9: Make a list
  10. Beginner 10: Grab the first item
  11. Beginner 11: Grab the last item
  12. Beginner 12: How many items?
  13. Beginner 13: Add it all up
  14. Beginner 14: Biggest and smallest
  15. Beginner 15: Add to a list

Beginner 1: Say hello

+20 XP

You are a data analyst in the Finance team. print() shows words on the screen.

PYTHONprint()

Beginner 2: Do a sum

+20 XP

You are a data analyst in the Finance team. Python is a calculator. + adds numbers.

PYTHONMaths

Beginner 3: A box called a variable

+20 XP

You are a data analyst in the Finance team. A variable is a labelled box that keeps a value.

PYTHONVariables

Beginner 4: A word box

+20 XP

You are a data analyst in the Finance team. Text in quotes is called a string.

PYTHONStrings

Beginner 5: Join words

+20 XP

You are a data analyst in the Finance team. + glues two strings together.

PYTHONStrings

Beginner 6: Fill in the blanks

+20 XP

You are a data analyst in the Finance team. An f-string drops a variable inside {curly brackets}.

PYTHONf-strings

Beginner 7: What type is it?

+20 XP

You are a data analyst in the Finance team. type() tells you if something is a number or text.

PYTHONtype()

Beginner 8: Turn text into a number

+20 XP

You are a data analyst in the Finance team. int() changes "5" (text) into 5 (number).

PYTHONint()

Beginner 9: Make a list

+20 XP

You are a data analyst in the Finance team. A list keeps many values in one box, inside [square brackets].

PYTHONLists

Beginner 10: Grab the first item

+20 XP

You are a data analyst in the Finance team. Python counts from 0, so [0] is the first item.

PYTHONIndexing

Beginner 11: Grab the last item

+20 XP

You are a data analyst in the Finance team. [-1] means the last item.

PYTHONIndexing

Beginner 12: How many items?

+20 XP

You are a data analyst in the Finance team. len() counts the items in a list.

PYTHONlen()

Beginner 13: Add it all up

+20 XP

You are a data analyst in the Finance team. sum() adds every number in a list.

PYTHONsum()

Beginner 14: Biggest and smallest

+20 XP

You are a data analyst in the Finance team. max() finds the biggest, min() the smallest.

PYTHONmax() / min()

Beginner 15: Add to a list

+20 XP

You are a data analyst in the Finance team. append() puts a new item at the end.

PYTHONappend()

Beginner · Comparisons & ==

5 exercises — finish them all to earn a certificate

0/5 done
5 questions left to earn this certificate
  1. Beginner 16: Is it bigger?
  2. Beginner 17: Is it the same?
  3. Beginner 18: Make a choice with if
  4. Beginner 19: Otherwise use else
  5. Beginner 20: Leave a note

Intermediate · Dictionaries & For Loops

15 exercises — finish them all to earn a certificate

0/15 done
15 questions left to earn this certificate
  1. Intermediate 1: Repeat with a for loop
  2. Intermediate 2: Count to 5
  3. Intermediate 3: Keep a running total
  4. Intermediate 4: Loop with if inside
  5. Intermediate 5: Repeat while true
  6. Intermediate 6: Three choices with elif
  7. Intermediate 7: And / or
  8. Intermediate 8: Your first function
  9. Intermediate 9: Give the function an input
  10. Intermediate 10: Get an answer back
  11. Intermediate 11: A function for averages
  12. Intermediate 12: A dictionary
  13. Intermediate 13: Change a dictionary
  14. Intermediate 14: Loop over a dictionary
  15. Intermediate 15: A list of rows

Intermediate 1: Repeat with a for loop

+20 XP

You are a data analyst in the Finance team. for goes through a list one item at a time.

PYTHONfor loops

Intermediate 2: Count to 5

+20 XP

You are a data analyst in the Finance team. range(5) gives 0,1,2,3,4.

PYTHONrange()

Intermediate 3: Keep a running total

+20 XP

You are a data analyst in the Finance team. Start at 0 and add each item.

PYTHONAccumulators

Intermediate 4: Loop with if inside

+20 XP

You are a data analyst in the Finance team. Combine for and if to keep only some values.

PYTHONFiltering

Intermediate 5: Repeat while true

+20 XP

You are a data analyst in the Finance team. while repeats as long as the question stays True.

PYTHONwhile

Intermediate 6: Three choices with elif

+20 XP

You are a data analyst in the Finance team. elif means 'else if' — another question to try.

PYTHONelif

Intermediate 7: And / or

+20 XP

You are a data analyst in the Finance team. and needs both to be True; or needs just one.

PYTHONLogic

Intermediate 8: Your first function

+20 XP

You are a data analyst in the Finance team. def makes a little machine you can reuse.

PYTHONdef

Intermediate 9: Give the function an input

+20 XP

You are a data analyst in the Finance team. Things inside the brackets are inputs.

PYTHONParameters

Intermediate 10: Get an answer back

+20 XP

You are a data analyst in the Finance team. return hands a result back out of the function.

PYTHONreturn

Intermediate 11: A function for averages

+20 XP

You are a data analyst in the Finance team. Wrap a calculation so you can reuse it.

PYTHONFunctions

Intermediate 12: A dictionary

+20 XP

You are a data analyst in the Finance team. A dictionary matches a key to a value, like a phone book.

PYTHONDictionaries

Intermediate 13: Change a dictionary

+20 XP

You are a data analyst in the Finance team. Assign to a key to add or change it.

PYTHONDictionaries

Intermediate 14: Loop over a dictionary

+20 XP

You are a data analyst in the Finance team. .items() gives each key and value together.

PYTHON.items()

Intermediate 15: A list of rows

+20 XP

You are a data analyst in the Finance team. Real tables are often a list of dictionaries.

PYTHONList of dicts

Intermediate · Sorted() & In

5 exercises — finish them all to earn a certificate

0/5 done
5 questions left to earn this certificate
  1. Intermediate 16: Sort a list
  2. Intermediate 17: Is it in the list?
  3. Intermediate 18: Slice a list
  4. Intermediate 19: Tidy up text
  5. Intermediate 20: Split text into parts

Advanced · Comprehensions & Enumerate()

15 exercises — finish them all to earn a certificate

0/15 done
15 questions left to earn this certificate
  1. Advanced 1: List comprehension
  2. Advanced 2: Comprehension with a filter
  3. Advanced 3: Dictionary comprehension
  4. Advanced 4: Number each item
  5. Advanced 5: Tiny functions with lambda
  6. Advanced 6: Group totals by category
  7. Advanced 7: Catch an error
  8. Advanced 8: Clean bad values
  9. Advanced 9: Default values
  10. Advanced 10: One-line if
  11. Advanced 11: Make a class
  12. Advanced 12: Give a class a method
  13. Advanced 13: Import a module
  14. Advanced 14: Read CSV text
  15. Advanced 15: Work with JSON

Advanced 1: List comprehension

+20 XP

You are a data analyst in the Finance team. A one-line loop that builds a new list.

PYTHONComprehensions

Advanced 2: Comprehension with a filter

+20 XP

You are a data analyst in the Finance team. Add if at the end to keep only some items.

PYTHONComprehensions

Advanced 3: Dictionary comprehension

+20 XP

You are a data analyst in the Finance team. Build a dictionary in one line.

PYTHONComprehensions

Advanced 4: Number each item

+20 XP

You are a data analyst in the Finance team. enumerate gives the position and the item.

PYTHONenumerate()

Advanced 5: Tiny functions with lambda

+20 XP

You are a data analyst in the Finance team. lambda is a one-line function without a name.

PYTHONlambda

Advanced 6: Group totals by category

+20 XP

You are a data analyst in the Finance team. Use a dictionary to add up numbers per category.

PYTHONGrouping

Advanced 7: Catch an error

+20 XP

You are a data analyst in the Finance team. try runs risky code; except catches the mistake politely.

PYTHONtry / except

Advanced 8: Clean bad values

+20 XP

You are a data analyst in the Finance team. Skip values that can't become numbers.

PYTHONData cleaning

Advanced 9: Default values

+20 XP

You are a data analyst in the Finance team. Give a parameter a default so it's optional.

PYTHONDefault args

Advanced 10: One-line if

+20 XP

You are a data analyst in the Finance team. a if test else b picks one of two values.

PYTHONTernary

Advanced 11: Make a class

+20 XP

You are a data analyst in the Finance team. A class is a blueprint for objects that hold data.

PYTHONClasses

Advanced 12: Give a class a method

+20 XP

You are a data analyst in the Finance team. A method is a function that lives inside a class.

PYTHONMethods

Advanced 13: Import a module

+20 XP

You are a data analyst in the Finance team. import borrows ready-made tools.

PYTHONimport

Advanced 14: Read CSV text

+20 XP

You are a data analyst in the Finance team. The csv module turns lines of text into rows.

PYTHONcsv module

Advanced 15: Work with JSON

+20 XP

You are a data analyst in the Finance team. JSON is how apps send data. json.dumps turns a dict into text.

PYTHONjson

Advanced · Groupby & Yield

5 exercises — finish them all to earn a certificate

0/5 done
5 questions left to earn this certificate
  1. Advanced 16: Pandas DataFrame
  2. Advanced 17: Filter a DataFrame
  3. Advanced 18: Group a DataFrame
  4. Advanced 19: Generators save memory
  5. Advanced 20: Mini report script