Beginnen met Python

python_logoEen technische programmeertaal waarmee je ook op de Raspberry Pi uit de voeten kunt. Die je toegang geeft tot een harde IT wereld. Modern en open source.

Oh, Python.

Juist.

Downloaden

Op je OSX staat alleen Python 2.7. Wat hebben we daar nu aan? Nada. Gauw versie 3  ophalen en installeren.

Idle3

Na het installeren van Python3 heeft je Appletje nu ook Idle in versie 3. Dat is de programmeer-omgeving (IDE) voor Python. Start idle.

Oefenprogramma intro.py

Download en open het programma intro.py in Idle3.

Stap voor stap

  • Run het programma met F5 of  Menu -> Run -> Run Module.
  • Lees dit:
#The lines that start with a hash (#) are comments
# They are for you to read and are ignored by Python

# When you see \'GO!\', save and run the file to see the output
# When you see a line starting with # follow the instructions
# Some lines are python code with a # in front
# This means they\'re commented out - remove the # to uncomment
# Do one challenge at a time, save and run after each one!
  • Ofwel, telkens als je RUN ziet staan, moet je daar iets doen in de code, opslaan en runnen. Introoowww!

CONTENTS

  • Printing
  • Variables
  • Basic maths operators (add, subtract, multiply)
  • Basic variable types (strings, integers)
  • Concatenating strings
  • Casting an integer to a string
  • Booleans (True / False)
  • Inequalities (Greater Than / Less Than)
  • If/Else statements
  • Lists
  • List methods (append, extend)
  • Adding lists together with
  • Sets
  • For Loops
  • Indexing strings
  • Splitting strings
  • Tuples
  • Dictionaries