Presentation is loading. Please wait.

Presentation is loading. Please wait.

Understanding Code Workshop 2.

Similar presentations


Presentation on theme: "Understanding Code Workshop 2."— Presentation transcript:

1 Understanding Code Workshop 2

2 Basic Python Functions
The basic Python functions we learnt in Workshop 1 were: variables, lists, print statements, if, else, elif conditions, for loops, while loops. You also learnt how to create your own functions. You should be aware that when writing code, you must indent correctly whenever using a colon. If you missed the last workshop, go to ucldata.com, click syllabus and read through Tutorial 2.

3 Dividing in Python (special functions)
Just like adding and subtracting, you can divide numbers in Python using the ‘ / ’ operator. You can get just the quotient (whole number part of division) or just the remainder by using the ‘mod’ and ‘div’ functions. The ‘mod’ function returns the quotient (whole number part) and it is done using the ‘%’ operator. For example, 24%5 will return 4. The ‘div’ function returns the remainder part and it is done using the ‘//’ operator. For example, 24//5 will return 4.

4 What does this code do?

5 What does this code do?

6 Work through Worksheet 2:
Work through Worksheet 2 on the Syllabus page on ucldata.com Ask if you need any help and try getting it done by the next workshop.


Download ppt "Understanding Code Workshop 2."

Similar presentations


Ads by Google